COUNT vs mysql_num_rows
Posted: Fri Feb 06, 2004 1:24 am
What I want to do is:
But I'm not sure how to reference the result.
If I change the query to:
In that case I can use mysql_num_rows to get the equivalent of "Count".
But is that how I really want to do it? It seems that there should be a more direct way to get Count out of the database.
Code: Select all
<?php
$sql = "select count from myTable where myField > yourDate";
$result = mysql_query($sql);
?>If I change the query to:
Code: Select all
<?php
$sql = "select * from myTable where myField > yourDate";
?>But is that how I really want to do it? It seems that there should be a more direct way to get Count out of the database.