title: How to load and display data from mysql?
body: <p>I want to load and display date form mysql, but program show me an error.</p>
  <p><strong>Error</strong></p>
  <blockquote>
  <p>Fatal error: Uncaught Error: Call to a member function fetch_assoc()
  on bool in C:\xampp\htdocs\quiz\index1.php:20 Stack trace: #0 {main}
  thrown in C:\xampp\htdocs\quiz\index1.php on line 20</p>
  </blockquote>
  <p><strong>Code</strong></p>
  <pre><code>&lt;?php
     require_once &quot;connect1.php&quot;;
  
     $polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
  
     if($polaczenie-&gt;connect_errno!=0)
     {
        echo &quot;Error&quot;.$polaczenie-&gt;connect1_errno. &quot; Opis: &quot;. $polaczenie-&gt;connect1_error;
     } else {
        $sql = &quot;SELECT tresc FROM quiz&quot;;
        $result = $polaczenie-&gt;query($sql);
        while($record = $result-&gt;fetch_assoc())
        {
          echo $record['tresc'];
        }
     }
  ?&gt;
  </code></pre>