php - mysql COUNT(*) always returns 8 -
the title says all. have below code:
public function getrows($table) {      $result = mysql_query("select count(*) `".$table."`");     if (! $result) {         throw new exception(mysql_error().".  query was:\n\n".$query."\n\nerror number: ".mysql_errno() . ".table = ".$table);     }     return $result; } seems should easiest function ever, result returns 8.
any ideas?
thanks, josh
your function returns mysql_query() function result, not results of sql query.
you have mysql_fetch_assoc() mysql_* old php functions.
ps: should use pdo now, mysql_* deprecated, it's tip ;)
Comments
Post a Comment