title: How to have multicolumn in a pdf through php and fpdf
body: <p>I am having some trouble with php and fpdf.</p>
  
  <p>I have to make a report in pdf format through fpdf and php in which i want to show students a teacher is teaching. </p>
  
  <p>What i want is that the fpdf should create a page with multiple column with same field.</p>
  
  <p>link of the pic: <a href="http://i1267.photobucket.com/albums/jj552/ThePerfectH/abc.png" rel="nofollow">http://i1267.photobucket.com/albums/jj552/ThePerfectH/abc.png</a> </p>
  
  <p>in this image as you can see, i want the data till 30 in one column and after that it should move in different column in one page.</p>
  
  <p>Example Code:</p>
  
  <pre><code>$result=mysql_query("select p.p_sname as pap from sgm, students st
      left join sps on st.studentid=sps.studentid
      left join papers p on p.p_id=sps.paperid where p.type='optional' and
      sgm.studentid=st.studentid and sgm.groupid=3 and st.course=3 and
      st.status='Regular' order by name");
      if($result === FALSE)
  {
  die(mysql_error()); // better error handling
  }
  $i=0;
  $max=30;
  $s=1;
  $row_height = 6;
  $y_axis = 33 + $row_height;
  while($row = mysql_fetch_array($result))
  {
  //If the current row is the last one, create new page and print column title
  if ($i == $max)
  {
      $y_axis= 33 + $row_height;
      $pdf-&gt;SetX(80);
      $pdf-&gt;SetTextColor(153,0,102);
      $pdf-&gt;SetFont('Arial','',10);
          //print column titles for the current page
      $pdf-&gt;SetY(33);
      $pdf-&gt;SetX(80);
      $pdf-&gt;Cell(20,6,'S No.',1,0,'C',1);
      $pdf-&gt;SetY($y_axis);
      $pdf-&gt;SetX(80);
      $pdf-&gt;Cell(20,6,$s,1,0,'C',1);
      $y_axis = $y_axis + $row_height;
          $i = $i + 1;
      $s=$s+1;
  
  
  }
  
          $rollno=$row['rollno'];
      $name=$row['name'];
      $cat=$row['cat'];
      $pap=$row['pap'];
      $pdf-&gt;SetY($y_axis);
      $pdf-&gt;SetX(48);
      $pdf-&gt;SetFont('Arial','',10);
      $pdf-&gt;Cell(20,6,$s,1,0,'C',1);
      //Go to next row
      $s=$s+1;
      $y_axis = $y_axis + $row_height;
  
          $i = $i + 1;    }       
  </code></pre>
  
  <p>As you can see in the pic, this is leading to overlapping of my row after creating just one new column.</p>
  
  <p>Can any one help.</p>