so I did a multi filter search in mysqli where you can search using textbox, collection id or type id.
The problem is that when using the search textbox, it returns a
Call to a member function fetch_object() on boolean
But it only returns that error when I type in a string or a single letter. When I type in a digit such as 1 or 2, it works perfectly fine and brings the correct result. Thanks
`
$whereClauses = array();
if (! empty($_POST['search'])) $whereClauses[] = 'tblfurniture.product_name ='.'%'.mysql_real_escape_string($_POST['search']).'%';
if (! empty($_POST['collection'])) $whereClauses[] ='tblfurniture.COLID='.mysql_real_escape_string($_POST['collection']);
if (! empty($_POST['type'])) $whereClauses[] = 'tblfurniture.TYPID='.mysql_real_escape_string($_POST['type']);
$where = '';
if (count($whereClauses) > 0) {
$where = 'WHERE '.implode(' AND ',$whereClauses);
}
$results = $mysqli->query("SELECT * FROM tblfurniture JOIN tblcollection ON tblfurniture.COLID = tblcollection.COLID ".$where);
}
else {
$conn = mysqli_connect('localhost', 'root', '', 'hezefurniture');
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$results = $mysqli->query("SELECT * FROM tblfurniture
JOIN tblcollection ON tblfurniture.COLID = tblcollection.COLID
ORDER BY tblfurniture.product_id");
}
while($row = $results->fetch_object())
{`