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\']); }
I know it's not exactly what you have asked for - but why don't you simply use a for-loop instead of while?
for ($i = 0; $row = mysql_fetch_assoc($result); ++$i) { echo $i . $row['foo']; }