wtfsmd Posted December 8, 2007 Share Posted December 8, 2007 I need a little help figuring out how to display a number on the side of my query results starting with 1 and ending with *, basically showing how many results were found example: 1 Apples 2 Oranges 3 Pears 4 Bananas and i don't want it to be the id because when i sort them i don't want it to look like: 2 Oranges 1 Apples 4 Bananas 3 Pears but rather: 1 oranges 2 Apples 3 Bananas 4 Pears Basically it will be in no particular order just the number of results. Link to comment https://forums.phpfreaks.com/topic/80727-solved-auto-number-results-from-query/ Share on other sites More sharing options...
pocobueno1388 Posted December 8, 2007 Share Posted December 8, 2007 Like this <?php $num = 1; while ($row = mysql_fetch_assoc($query)){ echo $num.' '.$row['col'].'<br>'; $num++; } ?> Link to comment https://forums.phpfreaks.com/topic/80727-solved-auto-number-results-from-query/#findComment-409486 Share on other sites More sharing options...
wtfsmd Posted December 8, 2007 Author Share Posted December 8, 2007 Thanks worked like a charm. Link to comment https://forums.phpfreaks.com/topic/80727-solved-auto-number-results-from-query/#findComment-409487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.