jasont8 0 Posted January 16, 2017 Report Share Posted January 16, 2017 so when starting up the wishlist.php using the book scripts of the second site, I'm getting an error that An error occurred in script '/var/www/html/ex2/html/wishlist.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean givenArray. what does this error and mean. How do I go about fix it? Is it a problem with the data in the database? Quote Link to post Share on other sites
Larry 428 Posted January 16, 2017 Report Share Posted January 16, 2017 Yeah, that error means your database query broke and didn't return any rows. I would print out the query being run and run it using another interface (like the mysql client) to see what's going on. It's normally an issue with the data or database. Quote Link to post Share on other sites
jasont8 0 Posted January 16, 2017 Author Report Share Posted January 16, 2017 I'm currently using phpmyadmin if that counts but I'm not sure how to go about fixing this problem and I been stuck for a while. I just began using mysql. do you need to see the code? Quote Link to post Share on other sites
Larry 428 Posted January 16, 2017 Report Share Posted January 16, 2017 You can use phpMyAdmin. I don't need to see the code (unless you made a mistake). wishlist.php uses stored procedures like get_wish_list_contents. I'd confirm that you created those in the database. Quote Link to post Share on other sites
jasont8 0 Posted January 16, 2017 Author Report Share Posted January 16, 2017 looking though phpmyadmin, I don't have the tables for the wishlist like get_wish_list_contents, what are the tables required for the wishlist and how do I make them? Quote Link to post Share on other sites
Larry 428 Posted January 16, 2017 Report Share Posted January 16, 2017 Those aren't tables, they are stored procedures. See the instructions in Chapters 7 & 8. Quote Link to post Share on other sites
jasont8 0 Posted January 17, 2017 Author Report Share Posted January 17, 2017 so i look at the myphpadmin to check that I have the stored procedures from the book and apparently I do. I'm still getting this error and I don't know why. An error occurred in script '/var/www/html/ex2/html/wishlist.php' on line 81: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given Array ( [0] => Array ( [function] => my_error_handler [args] => Array ( [0] => 2 [1] => mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given [2] => /var/www/html/ex2/html/wishlist.php [3] => 81 [4] => Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( [SESSION] => a902b14df889f3355f141a5e1355ef2b ) [_FILES] => Array ( ) [uid] => a902b14df889f3355f141a5e1355ef2b [page_title] => Coffee - Your Wish List [r] => [dbc] => mysqli Object ( [affected_rows] => -1 [client_info] => mysqlnd 5.0.12-dev - 20150407 - $Id: 241ae00989d1995ffcbbf63d579943635faf9972 $ [client_version] => 50012 [connect_errno] => 0 [connect_error] => [errno] => 1146 [error] => Table 'ecommerceshop.wish_lists' doesn't exist [error_list] => Array ( [0] => Array ( [errno] => 1146 [sqlstate] => 42S02 [error] => Table 'ecommerceshop.wish_lists' doesn't exist ) ) [field_count] => 0 [host_info] => Localhost via UNIX socket [info] => [insert_id] => 0 [server_info] => 5.7.16-0ubuntu0.16.04.1 [server_version] => 50716 [stat] => Uptime: 44779 Threads: 2 Questions: 401 Slow queries: 0 Opens: 224 Flush tables: 1 Open tables: 135 Queries per second avg: 0.008 [sqlstate] => 00000 [protocol_version] => 10 [thread_id] => 41 [warning_count] => 0 ) ) ) ) [1] => Array ( [file] => /var/www/html/ex2/html/wishlist.php [line] => 81 [function] => mysqli_num_rows [args] => Array ( [0] => ) ) ) Quote Link to post Share on other sites
Larry 428 Posted January 18, 2017 Report Share Posted January 18, 2017 That's very helpful. If you look at the error message, you'll see the problem: [error] => Table 'ecommerceshop.wish_lists' doesn't exist Quote Link to post Share on other sites
jasont8 0 Posted January 18, 2017 Author Report Share Posted January 18, 2017 thank you, I been wondering what was the error for the longest time. Quote Link to post Share on other sites
Larry 428 Posted January 19, 2017 Report Share Posted January 19, 2017 Yeah, anytime a database query is not working you'll want to print out and look at the detailed error message to see why. Quote Link to post Share on other sites
Alexqicy 0 Posted October 21, 2017 Report Share Posted October 21, 2017 I was trying to run my php code on my home computer using Apache as my web server I got Undefined variable error: Notice: Undefined variable: error in /var/www/html/contact.php on line 209. However my php code works just fine on my hosting web server. So Im guessing this is some kind of settings but I dont know where. Can someone help me? I did not find any solution online. Thanks in advance Quote Link to post Share on other sites
Larry 428 Posted October 22, 2017 Report Share Posted October 22, 2017 What's the code you're using? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.