Need Help - Error Message: mysqli_num_rows() expects parameter 1 to be mysqli_result


Please help, working on school assignment but I am not very good with php

I keep getting this error with the following code:
An error occurred in script ‘/storage/ssd4/544/8111544/public_html/wishlist.php’ on line 80:
mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given

// Get the wish list contents:
$r = mysqli_query($dbc, “CALL get_wish_list_contents(’$uid’)”);

if (mysqli_num_rows($r) > 0) { // Products to show!
include (’./views/wishlist.html’);
} else { // Empty cart!
include (’./views/emptylist.html’);


Well, first, you are calling a stored mysql procedure. It could be that it is failing.
Next, you have no error-checking or reporting, so you can not know what failed.
You can add this loosely like this:
$r = mysqli_query($dbc, “CALL get_wish_list_contents(’$uid’)”) or die("ERROR: " . $myslqi_error($dbc) );
Then, it should display the error and you can know at least what is wrong.
The error message you showed just says the $r is not correct. Normally, you would test at each step and if errors occur, you would not do the rest of the code. So, if the query fails, there is no reason to check if there were any results counted in mysqli_num_rows… Hope this helps!


This is the link to the site, though I am having the same issue throughout the website.


Well, that link does not work. Most likely because you must be logged it to see it since it is a school site.
Just show us you error and the code area that is giving the error and we can help.

You need to add error reporting to your code, test it and show us the results. Then we can help fix errors.
Normally, you test if the query worked and if not throw an error and if it does work you then read the number
of rows and display the results.