Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('ACTION', true);
- include('../../common.php');
- $page_title = 'Export';
- $mysql_tb = $userdata['user_name'];
- include '../../config1.php';
- $hostname=$config1['DB_HOST'];
- $username=$config1['DB_USERNAME'];
- $password=$config1['DB_PASSWORD'];
- $db = $config1['DB_DATABASE'];
- // Create connection
- $conn = new mysqli($hostname, $username, $password, $db);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- // Include the main TCPDF library (search for installation path).
- require_once('tcpdf_include.php');
- // create new PDF document
- $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- // set document information
- $pdf->SetCreator(PDF_CREATOR);
- $pdf->SetAuthor('asd');
- $pdf->SetTitle('asd');
- $pdf->SetSubject('asda');
- $pdf->SetKeywords('asd');
- // set default monospaced font
- $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- // set auto page breaks
- // set image scale factor
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- // set some language-dependent strings (optional)
- if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
- require_once(dirname(__FILE__).'/lang/eng.php');
- $pdf->setLanguageArray($l);
- }
- // ---------------------------------------------------------
- // set font
- $pdf->setFont('freeserif');
- // add a page
- $pdf->AddPage();
- $pdf->setFont('freeserif');
- // -----------------------------------------------------------------------------
- $dbh = new PDO("mysql:host=$hostname;dbname=$db", $username, $password);
- foreach($dbh->query("SELECT NazwaStazu, Stanowisko, Data, Miejsce, Inicjaly, Plec, NazwiskoOperatora, NazwiskaAsyst, NazwaZabiegu
- FROM " . $mysql_tb . "
- ") as $row) {
- $tbl = <<<EOD
- <p>MojeZabiegi.pl</p><br><br><br>
- <table width="700" border="1" cellpadding="4" cellspacing="0" style="border-collapse: collapse;">
- <tr>
- <td width="300" height="31">1. /nrwpisu/ </td>
- <td align="center" height="31"> {$row["NazwaStazu"]}</td>
- </tr>
- <tr>
- <td align="center" height="31"> {$row["Stanowisko"]}</td>
- <td align="center" height="31"> {$row["Data"]}</td>
- </tr>
- <tr>
- <td colspan = "2" height="31"> {$row["Miejsce"]}</td>
- </tr>
- <tr>
- <td align="center" height="31"> {$row["Inicjaly"]}</td>
- <td align="center" height="31"> {$row["Plec"]}</td>
- </tr>
- <tr>
- <td colspan = "2" height="31"> {$row["NazwiskoOperatora"]}</td>
- </tr>
- <tr>
- <td colspan = "2" height="31"> {$row["NazwiskaAsyst"]}</td>
- </tr>
- <tr>
- <td colspan = "2" height="31"> {$row["NazwaZabiegu"]}</td>
- </tr>
- <tr>
- <td height="138">11.</td>
- <td height="138">12.</td>
- </tr>
- </table>
- <br pagebreak="true"/>
- EOD;
- $pdf->writeHTML($tbl, true, false, false, false, "");
- }
- // -----------------------------------------------------------------------------
- //Close and output PDF document
- $pdf->Output("export.pdf", "I");
- //============================================================+
- // END OF FILE
- //============================================================+
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement