Jump to content
Larry Ullman's Book Forums

Shop.Php Mysqli_Num_Rows() Boolean Given


Recommended Posts

I am using this book currently as a guide of sorts to create an e-commerce store that doesn't sell coffee. So far, I have only modified the SQL here and there. To be specific, I am creating a store that sells handmade soap (long story). I have modified the SQL so that the tables, instead of having "coffee" in the name, have "soap" in the name. Also, instead of passing "goodies" or "coffee" to the "select_categories" procedure in shop.php, it will pass either "goodies" or "soaps". I have changed the corresponding stored procedures accordingly when I inserted them.

 

Here is my problem. When I test the script shop.php, I get the error "mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given". I have troubleshooted for a while now and figured I would post on the forums in the hope that someone could help me out. I haven't been able to test the Stored Procedures as I am using phpMyAdmin and get errors when I try to run stored procedures. I created them fine, but I can't test them, at least not in phpMyAdmin. Is there a way to make sure they work outside of phpMyAdmin? My guess is that the stored procedure is getting screwed up somehow, and so it is returning "false" instead of a number of rows returned. If anyone has any questions to better understand my code or anything, just let me know and I will be happy to do anything to get this problem resolved. Thanks!

Link to comment
Share on other sites

Yeah I have full permission on the database server. Here is the error I get when I try to run a stored procedure:

 

#1312 - PROCEDURE andrew_pss.select_categories can't return a result set in the given context

 

It auto appends andrew_pss (the database name) to the procedure. I have tried it from just about everywhere inside phpMyAdmin and I still get that error. I get that error on every procedure as well.

Link to comment
Share on other sites

I have a local installation of Xampp for testing some PHP scripts, and I believe that I can connect to my remote server using the MySQL command line installed with Xampp. I will Google it and try. I also might install a standalone MySQL administration client and connect remotely. I am hoping that the error with my PHP script is something simple and I wont have to go re-write all the Stored Procedures haha. Thanks for the help! I will update with what the problem is when I figure it out.

Link to comment
Share on other sites

To connect remotely to my server I have to log into the cPanel and add my IP to the hosts list. And since my IP is changing all the time (student) I delete the IP from the list as soon as I am done.

 

I figured out the problem though. The user that I am using in the mysql.inc.php file to log into the database to display categories and products didn't have permission to execute Stored Procedures. All I had to do was give that user Execute permission and the script works flawlessly now. So it turns out Jonathan was right, I just misinterpreted his post. I thought he meant do I have the permission from the administrator perspective, not do I have the permission set on the user logging in. My bad!

Link to comment
Share on other sites

 Share

×
×
  • Create New...