dsaba Posted April 24, 2007 Share Posted April 24, 2007 while($row = mysql_fetch_array($query)) { //do bunch of stuff //echo the current row# of the query } how do I echo the current row # in that while statement? its simple I know but didn't find it after checking my usual help resources -thanks Link to comment https://forums.phpfreaks.com/topic/48531-how-to-echo-the-current-row-in-mysql-while-loop/ Share on other sites More sharing options...
shaunrigby Posted April 24, 2007 Share Posted April 24, 2007 <?php echo $row['columnName']' ?> Where columnName is the name of the column you want to print from your DB Link to comment https://forums.phpfreaks.com/topic/48531-how-to-echo-the-current-row-in-mysql-while-loop/#findComment-237480 Share on other sites More sharing options...
dsaba Posted April 24, 2007 Author Share Posted April 24, 2007 you misunderstand me i meant the current numerical row of the query for example: 0 Link to comment https://forums.phpfreaks.com/topic/48531-how-to-echo-the-current-row-in-mysql-while-loop/#findComment-237481 Share on other sites More sharing options...
dsaba Posted April 24, 2007 Author Share Posted April 24, 2007 $i = 0 while($row = mysql_fetch_array($query)) { $i++; //do bunch of stuff //echo the current row# of the query } Link to comment https://forums.phpfreaks.com/topic/48531-how-to-echo-the-current-row-in-mysql-while-loop/#findComment-237496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.