Hi John,

"John Taylor-Johnston"  wrote in message:
> I use $mycounter, not saying it is pretty. But if you have a whole bunch
of stuff deleted, your last id might be worth a lot more than the actual
number of rows.
>
> $myconnection = mysql_connect($server,$user,$pass);
> mysql_select_db($db,$myconnection);
>
> $news = mysql_query('select * from '.$table.' where '.$where.' order by id
asc');
>  $mycounter = 0;
>  while ($mydata = mysql_fetch_object($news))
>  {
>   $mycounter++;
>  }

Have you ever considered just doing a count()?

$count = @mysql_query("select count(*) from [table(s)] where [criteria
[group by something]]");
$total = mysql_result($count, 0);

That will return the number of rows in your table(s). It's also much quicker
and less resource intensive, particularly with large datasets. :)

James



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

Reply via email to