Re: Count number of rows in table.
| From: | salamander | Date: | Sun, 25 Aug 2002 14:07:17 +0000 |
| Subject: | Re: Count number of rows in table. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-114050@lists.php.net to get a copy of this message | ||
or, you should be able to simply do this, without the cost of fetching the results:
$result = mysql_query("SELECT count(*) FROM table WHERE");
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";
$sql = "select count(*) from table_name WHERE ....."; $result = mysql_query($sql) or die(mysql_error); $row = mysql_fetch_row($result); $rowCount=$row[0];or $sql = "select count(*) from table_name WHERE ....."; $result = mysql_query($sql) or die(mysql_error); $rowCount=mysql_result($result); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php