server = $a;
$this->user = $b;
$this->password = $c;
$this->name = $d;
$this->conn = mysqli_connect($this->server, $this->user, $this->password, $this->name);
}
public function select($query){
$this->query = $query;
$sql = "SELECT * FROM `products` WHERE `name` LIKE '$query%'";
$result = mysqli_query($this->conn, $sql);
if(mysqli_num_rows($result) > 0){
if($this->query == ""){
echo ' Enter a query...';
}else{
while($rows = mysqli_fetch_assoc($result)){
echo '
'.$rows['name'].'
'.$rows['type'].' / '.$rows['country'].'
';
}
}
exit();
}else{
echo ' No entry found!';
exit();
}
}
}
?>