Ajax Shopping Cart with PHP and jQuery
  • Call to a member function fetch_assoc() on boolean

  • Asked by Saideep on 13th Oct 2017

Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\websites\ajax-shopping-cart-files-master\index.php on line 92

this is the issue iam getting

    Add Answer

    1 Answer

      • Saran

      That is because MySqli query returns false on failure. In your case maybe you have not created the required table in your database. You need to import products_list.sql in your database and make necessary changes in config.inc.php.

      But if you have already created table, just add this code to display any MySqli Error on the page. $mysqli->error will output MySqli error.

      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      //mysqli query $results = $mysqli_conn->query("SELECT product_name, product_desc, product_code, product_image, product_price FROM products_list"); if (!$result) { //on failure display error print "There was an mysql error :" . $mysqli_conn->error; exit; }

      I have also made changes in Github file, you can compare the changes.

      Can You Answer this? Help us answer the question!

        • Answer
        Supports basic Markdown syntax.