示例#1
0
function f5()
{
    $db = new DbAccess();
    $pdo = $db->getPDO();
    $pdf = new PDF_MC_Table('P', 'pt', 'letter');
    $pdf->SetFont('Helvetica', '', 10);
    $pdf->SetWidths(array(72, 72, 100, 72, 36));
    $pdf->SetVerticalPadding(5);
    $pdf->AddPage();
    $stmt = $pdo->query('select last, first, street, city, state
  from member order by last, first limit 50');
    while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
        $pdf->RowX($row);
    }
    $pdf->Output();
}
示例#2
0
	to determine which code is suitable for reuse in your own applications.

	Copyright 2013 Marc J. Rochkind. All rights reserved. May be copied and used
	under the BSD-type license at http://basepath.com/aup/copyright.htm.
*/
require_once 'lib/common.php';
use PDOException;
echo "{$_SERVER['DOCUMENT_ROOT']}/.config/credentials.php<br>";
echo "{$_SERVER['PHP_SELF']}<br>";
echo dirname(__FILE__) . '<br>';
echo dirname(__FILE__) . '/config/credentials.php<br>';
?>

<?php 
try {
    $db = new DbAccess();
    $pdo = $db->getPDO();
    $stmt = $pdo->prepare('select * from Customers');
    $stmt->execute();
    echo '<table border=1 cellspacing=0>';
    $first = true;
    while ($row = $stmt->fetch()) {
        if ($first) {
            echo '<tr>';
            foreach ($row as $attr => $val) {
                echo "<th>{$attr}";
            }
            $first = false;
        }
        echo '<tr>';
        foreach ($row as $attr => $val) {