title: Split Table After X Number of Rows & Add Text in While Loop (Using TCPDF)
body: <p>I have this statement which produces as many rows as it should do:</p>
  
  <pre><code>$result = mysqli_query($con,"SELECT * FROM b_sale_basket WHERE ORDER_ID=$ID ORDER BY     PRICE * QUANTITY DESC");
  
  $total=0;
  while($row = mysqli_fetch_array($result))
  {
  $quantity = $row['QUANTITY'];
  $description = $row['NAME'];
  $unitprice = $row['PRICE'];
  $lineprice = $row['PRICE']*$row['QUANTITY'];
  $total=$total+$lineprice;
  
  $tbl_header = '&lt;table style="width: 650px;" cellspacing="0" cellpadding="5"&gt;';
  $tbl_footer = '&lt;/table&gt;';
  $tbl = '';
  
  $tbl .= '
  &lt;tr&gt;
      &lt;td style="width: 50px; text-align: left; border-bottom: 0.1em solid #808080;"&gt;&lt;p style="color:#808080;"&gt;'.number_format($quantity,0).'&lt;/p&gt;&lt;/td&gt;
      &lt;td style="width: 350px; border-bottom: 0.1em solid #808080;"&gt;&lt;p style="color:#808080;"&gt;'.$description.'&lt;/p&gt;&lt;/td&gt;
      &lt;td style="width: 125px; text-align:right; border-bottom: 0.1em solid #808080;"&gt;&lt;p style="color:#808080;"&gt;'.number_format($unitprice,2).'&lt;/p&gt;&lt;/td&gt;
      &lt;td style="width: 125px; text-align:right; border-bottom: 0.1em solid #808080;" align="right" &gt;&lt;p style="color:#808080;"&gt;'.number_format($lineprice,2).'&lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  ';
  
   $pdf-&gt;writeHTML($tbl_header . $tbl . $tbl_footer, true, false, false, false, '');
  </code></pre>
  
  <p>As mentioned this returns the correct data.  However, I have a footer on the page set with SETXY within TCPDF and the table goes over this.  What I need is to add the text:</p>
  
  <pre><code>$pdf-&gt;AddPage();
  </code></pre>
  
  <p>After 10 rows and then the table continues on the next page.</p>
  
  <p>Any ideas?  If this can't be done, is there anyway of setting the setxy to not just sit in the background of the page?</p>