Hi, I am trying to count my tables using the COUNT(*) but having some trouble when making a custom function anyone know why it wont return nothing. I currently use this old code which works but it looks like old bad code. [code] $row = mysql_fetch_row(mysql_query("SELECT COUNT(*) AS numrows FROM table_news WHERE active='yes'")); $numrows = $row['numrows']; [/code] I tried making a function of my own but it wont work it returns nothing [code] function count($table, $where='') { if ($where != '') $where = "WHERE $where"; $query_id = $this->mysql_query("SELECT COUNT(*) FROM $table $where", false, true); list($count) = $this->mysql_fetchrow($query_id, MYSQL_ASSOC); $this->mysql_freeresult($query_id); return $count; } $numrows = count('table_news', "active='yes'"); [/code]