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

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -