I'm having the following error:
Object of class mysqli could not be converted to string.
PHP code:
<?php
include("config.php");
$query = $_GET['query'];
$min_length = 3;
if(strlen($query) >= $min_length){
$query = htmlspecialchars($query);
$query = mysqli_real_escape_string($conn,$query);
$row_results = mysqli_query($conn,"SELECT * FROM books
WHERE ('Title' LIKE '%".$query.$conn."%') OR ('text' LIKE '%".$query.$conn."%')") or die(mysqli_error());
if(mysqli_num_rows($row_results) > 0){
while($results = mysqli_fetch_array($row_results)){
echo "<p><h3>".$results['title']."</h3>".$results['text']."</p>";
}
}
else{
echo "No results";
}
}
else{
echo "Minimum length is ".$min_length;
}
?>
I do not understand what is missing