dlf1987 Posted August 6, 2008 Share Posted August 6, 2008 I want to use the same query 2x on the same page.. I tried this... <?php do { echo $row_rsTracking['track_id']; } while ($row_rsTracking = mysql_fetch_assoc($rsTracking)); mysql_data_seek($rsTracking, 0); //Reset ?> RESULTS: Line1 Line2 <?php do { echo $row_rsTracking['track_id']; } while ($row_rsTracking = mysql_fetch_assoc($rsTracking)); ?> RESULTS: [blank line] Line1 Line2 Why is there an extra line showing up for the 2nd do while? Link to comment https://forums.phpfreaks.com/topic/118510-reuse-do-while/ Share on other sites More sharing options...
lemmin Posted August 6, 2008 Share Posted August 6, 2008 Because you are using a DO WHILE which evaluates the condition after executing the code. $row_rsTracking probably doesn't exist at the first loop, but maybe you have error reporting off. At the second loop, $row_rsTracking was set to null from the previous conditional operation. It should work if you use a regular while loop instead. Link to comment https://forums.phpfreaks.com/topic/118510-reuse-do-while/#findComment-610123 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.