title: Blank rows when create table cell wrap data using fpdf
body: <p>I have this result in a table with FPDF library, but I need to show the info without the blank row (where is not info inside).</p>
  <p>Can you help me with this?, I need to show only rows with info.</p>
  <p>I use mysql while with PDO, the problem is the blank spaces in each row when the loop send the data...how can I show only rows with info??</p>
  <p><a href="https://i.stack.imgur.com/Z8vWX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z8vWX.jpg" alt="enter image description here" /></a></p>
  <p>Here is the code I use:</p>
  <pre><code>$i = 1;
  class PDF extends FPDF{
      
      function MultiAlignCell($w,$h,$text,$border=0,$ln=0,$align='L',$fill=false){
          // Store reset values for (x,y) positions
          $x = $this-&gt;GetX() + $w;
          $y = $this-&gt;GetY();
      
          // Make a call to FPDF's MultiCell
          $this-&gt;MultiCell($w,$h,$text,$border,$align,$fill);
      
          // Reset the line position to the right, like in Cell
          if( $ln==0 )
          {
              $this-&gt;SetXY($x,$y);
          }
      }
  }
  
  $pdf=new PDF('P','mm','Letter');    
  $pdf-&gt;AliasNbPages();
  $pdf-&gt;AddPage();
  
  //selecciona los examenes y los imprime en la hoja según id
  $stl = $conn-&gt;prepare(&quot;SELECT DISTINCT nombre, titulo, sir FROM EXAMS WHERE id = :id ORDER BY id ASC&quot;);
  $stl-&gt;bindParam(':id', $idL, PDO::PARAM_INT);
  $stl-&gt;execute();
  //cargamos los resultados de la base
  while($row = $stl-&gt;fetch(PDO::FETCH_ASSOC)) { 
          $pdf-&gt;SetFont('Times','',8);
          if($row['titulo'] != 1 ){ 
              $Y = $pdf-&gt;GetY();
              
              if($i == 1){
                  $pdf-&gt;SetX(20);
                  $width_cell=array(60,60,60);
                  $pdf-&gt;SetFont('Times','B',9);
                  $pdf-&gt;Cell($width_cell[0],5,'SENSIBLE',1,0,'C',false); 
                  $pdf-&gt;Cell($width_cell[1],5,'INTERMEDIO',1,0,'C',false); 
                  $pdf-&gt;Cell($width_cell[2],5,'RESISTENTE',1,0,'C',false); 
                  $Y = $pdf-&gt;GetY();
                  $pdf-&gt;SetY($Y + 5);
                  $pdf-&gt;SetFont('Times','',9);
              } else {
                  $pdf-&gt;SetY($Y);
              }
              $pdf-&gt;SetX(20);
              $width_cell=array(60,60,60);
              if(!empty($row['sir'])){
                  $pdf-&gt;Cell($width_cell[0],5,$row['sir'] == 1 ? utf8_decode($row['nombre']):'',1,0,'C',false); 
                  $pdf-&gt;Cell($width_cell[1],5,$row['sir'] == 2 ? utf8_decode($row['nombre']):'',1,0,'C',false); 
                  $pdf-&gt;Cell($width_cell[2],5,$row['sir'] == 3 ? utf8_decode($row['nombre']):'',1,0,'C',false); 
              }
              $Y = $pdf-&gt;GetY();
              $pdf-&gt;SetY($Y + 5);
              
              $i++;
          } 
  }
  
  $pdf-&gt;Output();
  </code></pre>