More efficient way to COUNT() MYSQL rows via PHP?

maidgusic

New Member
Here is how I am currently counting mysql rows in PHP:\[code\]//GET total # of results and build $start and $end for main SQL statement$sql= 'SELECT COUNT(*) FROM savedsearches WHERE user_id=\''.mysql_real_escape_string($user_id).'\'';$initial_query = mysql_query($sql) or die("SQL error");$num_sql = mysql_fetch_array($initial_query);$numrows = $num_sql[0];mysql_free_result($initial_query);\[/code\]Is there a more efficient way to do this?
 
Back
Top