honkmaster Posted July 19, 2014 Share Posted July 19, 2014 (edited) Hi, i'm having a hard time with this one, I need to create a PDF with the results from a query into a html table, all I'm getting is the first row when I should get 6!! I'm quite new to TCPDF so any help would be great. Code below $pdf = new TCPDF(); // add a page $resolution= array(210, 297); // set margins $pdf->SetAutoPageBreak(false, 0); $pdf->setCellMargins(0, 0, 0, 0); $pdf->setCellPaddings(0, 0, 0, 0); // remove default header/footer $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); // get data from users table $storeid = $row_rsStoreID['Allocation_StoreId']; $formcode = $row_rsStoreID['Allocation_FormCode']; $qty = $row_rsStoreID['Allocation_Quantity']; $store = $row_rsStoreID['Allocation_Name']; // ----------------------------------------------------------------------------- $pdf->Write(10,10,0, 'Example of HTML tables', '', 0, 'L', true, 0, false, false, 0); $pdf->SetFont('Helvetica', '', 12); if($totalRows_rsStoreID > 0) { while($row_rsStoreID = mysql_fetch_assoc($rsStoreID,MYSQL_ASSOC)) { $tbl = <<<EOD <table border="1" cellpadding="5" cellspacing="0"> <tr> <td>$storeid</td> <td>$formcode</td> <td>$qty</td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); // ----------------------------------------------------------------------------- //Close and output PDF document $pdf->Output('Test', 'I'); Edited July 19, 2014 by honkmaster Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2014 Share Posted July 21, 2014 That code isn't complete, but it looks like you are closing the PDF document after the first row. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now