Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 12
Joined: Tue Jan 21, 2003 2:27 pm

Tue Feb 04, 2003 2:22 pm

I am bringing records from a database to my page using mysql_fetch_row() to display a top 5 list.

The problem is I want to print out the postion at the start of each line, i.e.
1. some-name
2. some-name
3. some-name
4. some-name
5. some-name

I can't work out how to do this using while as it will print out the same value on each line! Can anybody help?


User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Tue Feb 04, 2003 4:35 pm

Try this one:

Code: Select all

$row = mysql_fetch_row($result);
   echo "- ".$i.": ".$row[$i]."<br>";

Post Reply