please help Me
my casus laike this:
i have table with 5 colums , after every cell in colum have data i want auto create 5 row with 5 colum too.
but that row auto create if every colum have data.
this code just for looping colums :
Code: Select all
<?php
$columns = 4;
$query = "SELECT * FROM rremarks WHERE r_name='$rid' ORDER BY r_date ASC";
$result = mysql_query( $query, $conn ) or die('Error, query failed');
for($i=0; $i < $columns; $i++ ) {
$myrow = mysql_fetch_array($result);
if($i % $columns == 0){
echo "<tr height=\"31\" style='color:black'>\n";
} if(!empty($myrow)){ ?>
<?php
if($myrow['r_date'] <= $today) {
echo "<td width=\"80\" valign=\"top\" style='border:1px solid silver'>" .
"<div style='padding-top:5px;'><a href=\"#\">$myrow[r_date]</a></div><div style='padding-top:5px;'><a href=\"#\">Report</a></div><div style='padding-top:5px;'><a href=equipmenta.php?rid=$regid>Equipment</a></div><div style='padding-top:5px;'><b>$myrow[r_coach]</b></div>" .
"</td>\n";
}else{
echo "<td width=\"80\" valign=\"top\" style='border:1px solid silver'>" .
"<div style='padding-top:5px;'><a href=\"#\">$myrow[r_date]</a></div><divstyle='padding-top:5px;'>Report</div><div style='padding-top:5px;'>Equipment</div><div style='padding-top:5px;'><b>$myrow[r_coach]</b></div>" . "</td>\n";
} ?>
<?php }else{ ?>
<form name="sche" onsubmit="return validate()" action="prorange.php" method="POST">
<td width="80" style="border:1px solid silver">
<input type="hidden" value="<?php echo $regid ?>" name="rn" id="rn">
<input name="ffr" type="hidden" value="Range" />
<div><input style="font-size:11px;" name="rd" onfocus="showCalendarControl(this);" type="text" size="8"></div>
<div style="padding-top:5px;">
<select style="font-size:11px;" name="rt" id="rt">
<option value="">time</option>
<?php foreach($htime as $t): ?>
<option value="<?php echo($t["timer"])?>"><?php echo($t["timer"])?></option>
<?php endforeach; ?>
</select>
</div>
<div style="padding-top:5px;">
<select style="font-size:11px; width:72px;" name="fc" id="fc">
<option value="">Coach</option>
<?php foreach($co as $o): ?>
<option value="<?php echo($o["cname"])?>"><?php echo($o["cname"])?></option>
<?php endforeach; ?>
</select>
</div>
<div style="padding-top:5px;"><input style="font-weight:bold; font-family:arial; font-size:11px; color:black;" type="submit" value="save" /></div>
</td></form>
<?php } ?>
<?php if(($i % $columns) == ($colum - 1) || ($i + 1) == $columns) {
echo "</tr>\n"; } } ?>