Normal query here:
$sql = mysql_query("SELECT * FROM table"); $sql2 = mysql_query($sql);
Heres our starting number (0)
$newno = 0;
Heres our while statement (0)
While ($row = MySQL_fetch_array($sql)){Heres what happenens!
The $newno variable for the first but is set to 0, and in the statement below we add one to it, so the total is 1.
When it repeats however it only repeats whats in the while statement, so our new math is 1+1, then it repeats to 2+1 and so on and so on - basically increments of 1
$newno = $newno + 1; echo" $newno [b][color=#FF0000]And we echo the the number and whatever mysql result.[/color][b] "; }
I used this on this page http://www.sfegaming...arcade/beta.php
(sorry if that counts as a plug:p)
If you look, top online games are numbered and I used it for layout purposes as well!
Look at the newest games box, see those smaller icons? Yup:)
Thats set up like this
if ($newno == 3){ echo"<br />"; }so if its the third icon it prints a <br />
Handy eh?
Hope this helped some people!