RE: Getting Query Results Row Number during a While Loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
I am creating a query and displaying the results during a while Loop.  I

know how to get the total number of rows but need to know which row I am

currently working on in the loop.
[/snip]

You need a variable, like $i, to hold the number, then increment and
display

$i = 0;

while(your database stuff happens){
	$i++;
	echo $i . "\n";
}
/* cleanup after the while loop is done */
unset($i);

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux