digit in mysqli query returns data but a string does not -
so did multi filter search in mysqli can search using textbox, collection id or type id.
the problem when using search textbox, returns
call member function fetch_object() on boolean
but returns error when type in string or single letter. when type in digit such 1 or 2, works fine , brings correct result.
` $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(' , ',$whereclauses);
} $results = $mysqli->query("select * 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 * tblfurniture
join tblcollection on tblfurniture.colid = tblcollection.colid order tblfurniture.product_id");
} while($row = $results->fetch_object()) {`
your query returning null value. seem executing wrong query on search textbox , use mysqli_error()
show error .
Comments
Post a Comment