Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in C:\xampp\htdocs\propertypage\index.php:42 Stack trace: #0 {main} thrown in C:\xampp\htdocs\propertypage\index.php on line 42

This is the line <?php while ($row=$read->fetch_assoc()) { ?>

    That usually indicates that there was an error of some sort in your SQL, causing in your case $read to be false, instead of whatever would normally have been returned by whichever DB query command you used to create it. Depending on which DB extension you're using, you could test if $read is false, and if so, use that DB extension's error-reporting methods to find out what went wrong.

      Concur. You should test for $read before using it, and possibly also test for rows:

      if ($read && $read->num_rows) {
      
          while ($row = $read->fetch_assoc()) {
                do_something();
         }
      }

      Or fail early, which is generally good design:

      if (!$read) {
          //error routine here.
      }

        Longer term you'll probably want to put the database access and db error handling in their own functions elsewhere, rather than doing everything in one long stream of commands on the page. For one thing, it will save repetition of code.

          Write a Reply...