Only the part which is $this->link->query($query) I understand that link is the member variable of the class Database but don't understand what is happening when $this->link->query($query) executes? help, I am a novice at coding
My whole code:
<?php
class Database
{
public $db_host=DB_HOST;
public $db_user=DB_USER;
public $db_pass=DB_PASS;
public $db_name=DB_NAME;
public $link;
public $error;
public function __construct()
{
// Call connect function
$this->connect();
}
private function connect()
{
$this->link= new mysqli($this->db_host,$this->db_user,$this->db_pass,$this->db_name);
if(!$this->link)
{
$this->error="Connection Failed";
return false;
}
}
public function select($query)
{
$result=$this->link->query($query) or die ("Query could not execute");
}
}
?>