I am instentiating $db object this way in my database class
class db{
private $connection;
public function __construct(){
$this->connect();
}
public function connect(){
$this->connection=mysqli_connect('localhost','root','','new5');
}
}
$db=new db;
I am using this $db object in another class(profile class) as link identifier as
$query=$db->query("SELECT id, parent_id, name FROM categories_general");
Please help me ,how can i get rid of this error.Actually I am recently shifted from mysql to mysqli.
add a function
try
You are using procedural style of mysqli. So you must create query method in db class.
or you can use object oriented style with extends method;