A pity there seems no way of getting the CURRENT row number that's under iteration in a typical loop,
such as:
while ($row = mysql_fetch_assoc($result)) { }
After all there is an array of row arrays, as signified by
mysql_num_rows($result):
Say this gives "40 rows" : it would be useful to know when the iteration is on row 39.
The nearest seems to be "data seek":but it connects directly to a
row number eg (from mysql_data_seek page)
for ($i = mysql_num_rows($result) - 1; $i >= 0; $i--) {
if (!mysql_data_seek($result, $i)) {
echo "Cannot seek to row $i: " . mysql_error() . "\n";
continue;
}
= it still wouldn't solve knowing what row number you're on in an ordinary loop.
One reason for this situation is the php fetch (fetch-a-single-row) construction, without any reasonable FOR loop possibility with row numbers.
Suggestion:
$Rows[$i] possibility where
$i would be the row number
$Rows[$row[], $row[], $row[].....]
0 1 2 etc
-- the excellent retrieval WITHIN a row ( $row[$i] ),
while certainly more important, is not matched by
similar possibilities for rows themselves.
and Count($result) doesnt work of course, $result being a
mere ticket-identifier...
Peter T