I have what is, to me, a confusing situation. The following code is producing a blank row on the web page. I'm using the same code on different pages and they are working fine. The row count is set to display 5 rows but is showing 6 with the first one being devoid of any dynamic data. I'm sure I've missed or overlooked something, can anyone shed any light on why this might be happening? Cheers
<?php
$counter = 0;
do {
$color = ($counter & 1)? "#FFF" : "#DEDEDE";
$counter++
?>
<tr style="background: <?php print $color; ?>">
<td ><a href="edit_workorder.php?jobID=<?php echo $row['jobID']; ?>" ><?php echo $row['wo_date']; ?></a></td>
<td />
<td ><?php echo $row['wcust_firstname']; ?> <?php echo $row['wcust_surname']; ?></td>
<td ><?php echo $row['wcust_address']; ?> - <?php echo $row['wcust_suburb']; ?></td>
<td ><?php echo $row['wo_equip']; ?></td>
<td />
<td ><?php echo $row['wo_problem']; ?></td>
<td />
<td ><?php echo $row['wtech_userlogin']; ?></td>
</tr>
<?php
} while($row = mysql_fetch_array($sql2))
// close while loop
?>
$row is not populated until you go through the loop the second time.
instead of
do{
...
}while($row = mysql_fetch_array($sql2))
do:
while($row = mysql_fetch_array($sql2)){
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With