I was wondering how can correct the error I keep0 getting listed below.
I get the following error.
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given on line 159
Line 159 is
$foundnum = mysqli_num_rows($run);
Here is part of the PHP & MySQL code.
mysqli_select_db($mysqli, "sitename");
$search_explode = explode(" ", $search);
foreach($search_explode as $search_each) {
$x++;
if($x == 1){
$construct .= "(users_comments.article_content LIKE '%$search_each%' OR users_comments.title LIKE '%$search_each%' OR users_comments.summary LIKE '%$search_each%')";
} else {
$construct .= "(OR users_comments.article_content LIKE '%$search_each%' OR users_comments.title LIKE '%$search_each%' OR users_comments.summary LIKE '%$search_each%')";
}
}
$construct = "SELECT users.*, users_comments.* FROM users INNER JOIN users_comments ON users.user_id = users_comments.user_id WHERE $construct ORDER BY users_comments.date_created DESC";
$run = mysqli_query($mysqli, $construct);
$foundnum = mysqli_num_rows($run);
if ($foundnum == 0) {
echo 'No results found.';
}