Please bear with me as this is my first post.
I am attempting to display info from sql tables. I already checked my sql code in sql admin and it gives me the right table I need but php is not giving me the results and giving me this: Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\Program\displaybook.php on line 91
I believe something is wrong with my SELECT statement or the way I am writing the statement in general.
ratings:
user_id | ISBN | Score | Description
11 | 425232204 | 5 | This is my favorite book!!
7 | 425232204 | 4 | I liked it.
users:
user_id | user_email | user_first | user_middle | user_last
7 | jerry@gmail.com | Jerry | W | Smith
11 | tpott78@att.net | Tristan | S | Potter
Query:
$sql = "SELECT *
FROM ratings
INNER JOIN users
ON users.'user_id' = ratings.'user_id'
WHERE ISBN = '$isbn'";
$results = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($results);
$count = 0;
if ($resultCheck > 0){
while ($row = mysqli_fetch_assoc($results) && $count < 5) {
$count += 1;
echo "<p>" . $row['user_first'] . " " . $row['user_last'] . " " . $row['Score'] . " " . $row['Description'] ."</p>";
}
}
Sorry I forgot that info that someone brought up in commits. Yes i have an include header file at the top of the php code that also connects to the db. I know this works cause I have some other SELECTS that are working fine.