Well i am trying to get the number of rows that match the criteria in the table. Here is my code. It shows nothing. someone please help me asap. Well i modified the code that i made for fetching data. I dunno where i went wrong. I am amateur to OOP .
<?php
$conn=mysql_connect('localhost','root','') or die("Could not connect to server.");
$db=mysql_select_db("career",$conn) or die("Database recess not found.");
class Database
{
public function selects($table, $rows, $where)
{
$q = 'SELECT '.$rows.' FROM '.$table;
if($where != NULL)
$q .= ' WHERE '.$where;
$query = @mysql_query($q);
$counts = @mysql_num_rows($query);
return $counts;
}
public function getResult()
{
return $this->result;
}
}
$show = new Database();
$show->selects("jobs","id","`city` = 'Nepalgunj'");
$show->getResult();
?>