title: Database Details in PDF are not getting filled?
body: <p>I am extracting data from MySQL database using php and exporting it as PDF. The columns are not getting filled due to the PDF page size. How do I push the unfilled columns to next line? So that first line has 4 columns and next line has another 4 columns, so on..</p>
  
  <pre><code>&lt;?php
  
  //include connection file
  include_once "connection.php";
  include_once 'fpdf/fpdf.php';
  
  class PDF extends FPDF {
      // Page header
      function Header() {
      }
  
      // Page footer
      function Footer() {
          // Position at 1.5 cm from bottom
          $this-&gt;SetY(-15);
          // Arial italic 8
          $this-&gt;SetFont('Arial', 'I', 8);
          // Page number
          $this-&gt;Cell(0, 10, 'Page '.$this-&gt;PageNo().'/{nb}', 0, 0, 'C');
      }
  }
  
  $db = new dbObj();
  $connString = $db-&gt;getConnstring();
  $id = $_GET['id'];
  $query = $connString-&gt;prepare("SELECT ID, Name, Wrongs, Rights, Percentage, Age FROM Datas WHERE ID=?");
  $query-&gt;bind_param('s', $id);
  $query-&gt;execute();
  $result = $query-&gt;get_result();
  $display_heading = array('ID' =&gt; 'ID', 'Name' =&gt; 'Name', 'Wrongs' =&gt; 'Wrongs', 'Rights' =&gt; 'Rights', 'Percentage' =&gt; 'Percentage', 'Age' =&gt; 'Age');
  
  //$result = mysqli_query($connString, "SELECT ID, Name, Wrongs, Rights, Percentage, Age FROM Datas") or die("database error:". mysqli_error($connString));
  $header = mysqli_query($connString, "SHOW columns FROM Datas");
  
  $pdf = new PDF();
  //header
  $pdf-&gt;AddPage();
  //foter page
  $pdf-&gt;AliasNbPages();
  $pdf-&gt;SetFont('Arial', 'B', 12);
  foreach ($header as $heading) {
      $pdf-&gt;Cell(45, 12, $display_heading[$heading['Field']], 1);
  }
  foreach ($result as $row) {
      $pdf-&gt;Ln();
      foreach ($row as $column) {
          $pdf-&gt;Cell(45, 12, $column, 1);
      }
  }
  $pdf-&gt;Output();
  </code></pre>