There seems to be an error with my SQL query. I keep getting this warning:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in
which I'm pretty sure points to a syntax error, I found an SQL checker online and it said there's an error as well. I've been looking over this for days and I just can't seem to find what's wrong.
Here's the code:
function countReplies($cid, $scid, $tid, $mysqli){
$select = mysqli_query($mysqli, "SELECT category_id, subcatgory_id, topic_id FROM replies WHERE ".$cid." = category_id AND ".$scid." = subcategory_id AND ".$tid." = topic_id");
return mysqli_num_rows($select);
}
EDIT:
After using
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
This is the error I'm getting now:
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''12' at line 6 in C:\xampp\htdocs(A)Book 2.0\Bootstrap\content_function.php:116 Stack trace: #0 C:\xampp\htdocs(A)Book 2.0\Bootstrap\content_function.php(116): mysqli_query(Object(mysqli), 'SELECT category...') #1 C:\xampp\htdocs(A)Book 2.0\Bootstrap\readtopic.php(55): countReplies('1', '2', '12', Object(mysqli)) #2 {main} thrown in C:\xampp\htdocs(A)Book 2.0\Bootstrap\content_function.php on line 116