I am fetching a number of results from my database using a mysql_query
. What I need to do is echo
the result number, along with the result itself.
In other words, if my query fetches 3 results, I would like the first result to have a 1
beside it, and the second result a 2
and so on. I need the numbers to start at 1, not 0.
note: I do not mean mysql_num_rows
as that only tells me how many results, not the result number itself.
Here is my query information:
$primary_img_query = "SELECT imgURL, imgTitle FROM primary_images WHERE primaryId=16";
$primary_img_data = mysql_query($primary_img_query) or die('MySql Error' . mysql_error());
while($row = mysql_fetch_assoc($primary_img_data)) {
echo "<img src='new_arrivals_img/thumbnails/".$row['imgURL']."'>";//this is where I want the result number echoed
}