I am having a problem with my MYSQL statement
Warning : mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\\Users\\RBLara\\Documents\\My Projects\\focalnews\\index.php on line 188
$sqltype = "SELECT * FROM focalnews_items ORDER BY datime ASC limit $last,20 WHERE (likes >= 5 OR love >= 5 OR informative >= 5)";
$resulttype = mysqli_query($conn, $sqltype);
if (mysqli_num_rows($resulttype) > 0) {
while($row = mysqli_fetch_assoc($resulttype))
{
$profile_pic = $row["profile_pic"];
$author = $row["author"];
$message = $row["message"];
$likes = $row["likes"];
$love = $row["love"];
$informative = $row["informative"];
$datime = $row["datime"];
$joined_date = $row["joined_date"];
}
}
?>
Any Idea please?
ORDER BY and LIMIT should be goes at the end.
You can use the multiple conditions in OR
as follows
WHERE likes >= 5 OR love >= 5 OR informative >= 5
Your query should be
$sqltype = "SELECT * FROM focalnews_items WHERE likes >= 5 OR love >= 5 OR informative >= 5 ORDER BY datime ASC limit $last,20";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.