ifusion Posted May 28, 2008 Share Posted May 28, 2008 Hey, My while loop isn't returning the first row, only the second and third rows of data etc? Why is that and how do i fix it? <?php while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>". $row['invoice_date']. "</td>"; echo "<td>". $row['due_in']. " days". "</td>"; echo "<td>". $row['invoice_id']. "</td>"; echo "<td>". $row['client_name']. "</td>"; echo "<td align=\"right\">"."$". $row['amount_due']. "</td>"; echo "</tr>"; } ?> Cheers, Fusion. Link to comment https://forums.phpfreaks.com/topic/107595-solved-while-loop-not-returning-the-first-row/ Share on other sites More sharing options...
garry Posted May 28, 2008 Share Posted May 28, 2008 It's because you're calling the $row function twice. I assume you've already set the $row variable before that block of code? Just delete the other $row and it should work. Link to comment https://forums.phpfreaks.com/topic/107595-solved-while-loop-not-returning-the-first-row/#findComment-551472 Share on other sites More sharing options...
ifusion Posted May 28, 2008 Author Share Posted May 28, 2008 Awsome dude, I had the $row = mysql_fetch_array($result) in a included file. Cheers man. Link to comment https://forums.phpfreaks.com/topic/107595-solved-while-loop-not-returning-the-first-row/#findComment-551474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.