title: I am fetching database data and and converting it to a pdf file. But not getting the correct output
body: <p>this is my code to get data from the database and then output the data in the pdf file. i am getting an error as shown in the image attatched. kindly help in resolving this error.   </p>
  
  <pre><code> &lt;?php
  
  
   $db= mysqli_connect('localhost','root','','guests') or die("error 
   connecting to mysqli server");  require_once __DIR__ . 
   '/vendor/autoload.php';
  
  
   $str = 'abcd'; $html=array(); $sql = 'SELECT * FROM  data';   
   //mysqli_query("SET NAMES 'utf8'"); $req = mysqli_query($db,$sql) or 
   die('Error SQL!'.$sql.'&lt;br&gt;'.mysqli_error());   
  
   ob_start()
  
   $mpdf=new mPDF(); 
  
    //ob_start();    while($row = mysqli_fetch_assoc($req)){  
    //ob_start();
    // $name = $row['name'];
    // $phone=$row['phone'];
    // $status=$row['status'];
    // //$html .='&lt;div class="form-group"&gt;'.$name.'&lt;/div&gt;'.'&lt;div 
   class="form-group"&gt;'.$phone.'&lt;/div&gt;'.'&lt;div class="form-
   group"&gt;'.$status.'&lt;/div&gt;';
   $html[]=$row;
  
      foreach ($html as $row ) {
          # code...
          //echo $row['name'];
          //var_dump($html);
          print_r(array_values($html));
          //die();
          $mpdf-&gt;AddPage('L','','','','',50,50,50,50,10,10);
  
  
          $str= $str. ob_get_contents();
          $mpdf-&gt;WriteHTML($str);
          //break;
      }
     //$mpdf-&gt;WriteHTML($html);
  
  
    //$mpdf-&gt;WriteHTML($content); } // var_dump($str); // die(); //$mpdf-
   &gt;WriteHTML($str);
  
   ob_end_clean();
  
   $mpdf-&gt;Output('pdf.pdf','I');
  
   ?&gt;
  </code></pre>
  
  <p>its showing me the error as
  <a href="https://i.stack.imgur.com/PbK7K.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PbK7K.jpg" alt="enter image description here"></a></p>