title: FPDF Cell Positioning
body: <p>I've started to study FPDF since I was required to generate a PDF file for my work. It was easy to learn but I've encountered some problems with customizing tables. </p>
  
  <p>See, these lines of codes:</p>
  
  <pre><code>&lt;?php
  require('fpdf/fpdf.php');
  require("aacfs.php"); //database connection
  
  $a=mysql_query("select * from reservation where reservno='00112'") or die(mysql_error());
  $b=mysql_fetch_array($a);
  $k=$b['fdate'];
  $j=$b['acode'];
  
  $t=mysql_query("select location from location_list where reservno='00112'") or die(mysql_error());
  
  $pdf = new FPDF();
  $pdf-&gt;AddPage();
  $pdf-&gt;SetFont('Arial','B',11);
  $pdf-&gt;Cell(40,10,'Flight Details and Costing');
  $pdf-&gt;Ln(8);
  $pdf-&gt;SetFont('Arial','',10);
  $pdf-&gt;Cell(60, 6, 'Aircraft', 1);
  $pdf-&gt;Cell(129, 6, $j, 1);
  $pdf-&gt;Ln();
  $pdf-&gt;SetFont('Arial','',10);
  $pdf-&gt;Cell(60, 6, 'Date', 1);
  $pdf-&gt;Cell(50, 6, 'Itinerary', 1);
  $pdf-&gt;Cell(19.75, 6, 'ETD', 1, 0, 'C');
  $pdf-&gt;Cell(19.75, 6, 'ETA', 1, 0, 'C');
  $pdf-&gt;Cell(19.75, 6, 'Block', 1, 0, 'C');
  $pdf-&gt;Cell(19.75, 6, 'Waiting', 1, 0, 'C');
  $pdf-&gt;Ln();
  $date = array($k, $k, $k,  '');
  foreach($date as $dates)
  {
      $pdf-&gt;Cell(60, 6, $dates, 1);
      $pdf-&gt;Ln();
  }
  while($u=mysql_fetch_array($t))
  {
      $pdf-&gt;Cell(50, 6, $u['location'], 1);
      $pdf-&gt;Ln();
  }
  
  $pdf-&gt;Output();
  ?&gt;
  </code></pre>
  
  <p>generates a PDF file that looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/rW437.jpg" alt="enter image description here"></p>
  
  <p>But what I want to do is to have the result of this code: </p>
  
  <pre><code>while($u=mysql_fetch_array($t))
      {
          $pdf-&gt;Cell(50, 6, $u['location'], 1);
          $pdf-&gt;Ln();
      }
  </code></pre>
  
  <p>which is: 
  <code>Davao - Cebu</code>
  <code>Cebu - Bohol</code>
  <code>Bohol - Davao</code> 
  to be under the <code>Itinerary</code>, like this: <img src="https://i.stack.imgur.com/xxmNQ.jpg" alt="enter image description here"></p>
  
  <p>I'm aware of the Cell() parameters <code>ln</code> which indicates where the current position should go after the call and the only options are: <code>0 - to the right</code>, <code>1 - to the beginning of the next line</code> and <code>2 - below</code> which doesn't have the option I need. I'm having a hard time 'cause I fetch the data from MySQL database so I don't know how to reposition it according to what I desire since the outputs are inside an array. Any ideas on how I can achieve what I want is greatly appreciated. Or what I want can't be achieved through this?</p>