conncet.php
connect();
}
private function connect()
{
$this->link = new mysqli($this->host, $this->user, $this->pass, $this->db);
return $this->link;
}
public function select($query)
{
$result = $this->link->query($query) or die($this->link->error.__LINE__);
if($result->num_rows > 0)
{
return $result;
}
else
{
return false;
}
}
?>
Now action.php where query can be done as follows :
$db = new database();
$query = "SELECT COUNT(*) FROM accounts";
$row = $db->select($query)->num_rows;
echo $row;
?>
Full conncetion.php : link