At 8/19/05 04:53 PM, Inglor wrote:
can't you either:
keep a variable?
use a counter and run untill !mysql_fetch_array ?
Uses more code to do that and more memory probably.
Here's two ways I do it.
<?php
$sql = "SELECT * FROM `table` WHERE `value`='value'";
$query = mysql_query($sql);
$num = mysql_num_rows($query);
print $num;
// and afterwards you can do a mysql_fetch_array if you want.
// and a different way:
$sql = "SELECT COUNT(*) FROM `table` WHERE `value`='value'";
$query = mysql_query($sql);
$num = mysql_result($query, 0, 0);
print $num;
?>