I have the following:
$counter = 1; while($row= mysql_fetch_assoc($result)) { $counter2 = $counter++; echo($counter2 . $row[\'foo\']); } <
$counter = 1; while($row= mysql_fetch_assoc($result)) { $counter2 = $counter++; echo($counter2 . $row[\'foo\']); }
You don't need $counter2. $counter++ is fine. You can even do it on the same line as the echo if you use preincrement instead of postincrement.
$counter = 0; while($row= mysql_fetch_assoc($result)) { echo(++$counter . $row['foo']); }