File manager - Edit - /home/custbahd/irungikitchen.com/admin1/print_pdf.php
Back
<?php function generateRow(){ $contents = ''; include_once('db/connection.php'); $sql = "SELECT * FROM shop"; //use for MySQLi OOP $query = $conn->query($sql); while($row = $query->fetch_assoc()){ $contents .= " <tr> <td>".$row['id']."</td> <td>".$row['name']."</td> <td>".$row['cat']."</td> <td>".$row['type']."</td> </tr> "; } //////////////// //use for MySQLi Procedural // $query = mysqli_query($conn, $sql); // while($row = mysqli_fetch_assoc($query)){ // $contents .= " // <tr> // <td>".$row['id']."</td> // <td>".$row['firstname']."</td> // <td>".$row['lastname']."</td> // <td>".$row['address']."</td> // </tr> // "; // } //////////////// return $contents; } require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle("Kerris Kid Care Items PDF"); $pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont('helvetica'); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetMargins(PDF_MARGIN_LEFT, '10', PDF_MARGIN_RIGHT); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetAutoPageBreak(TRUE, 10); $pdf->SetFont('helvetica', '', 14); $pdf->AddPage(); $content = ''; $content .= ' <h2 align="center">Kerris Kid Care Items PDF</h2> <h4>Items</h4> <table border="1" cellspacing="0" cellpadding="3"> <tr> <th width="5%">ID</th> <th width="20%">Item Title</th> <th width="20%">Category</th> <th width="20%">Type</th> <th width="55%">Test</th> </tr> '; $content .= generateRow(); $content .= '</table>'; $pdf->writeHTML($content); $pdf->Output('members.pdf', 'I'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 1.51 |
proxy
|
phpinfo
|
Settings