PEAR::DB : PEAR « Utility Function « PHP






PEAR::DB

 
include_once('DB.php');

    $conninfo = "mysql://username:password@localhost/phpdb";
    $db = DB::connect($conninfo);

    if (DB::isError($db)) {
            print $db->getMessage( );
            exit;
    }

    $result = $db->query("SELECT * FROM people;");

    while ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
            extract($row);
            print "$Name:  $NumVisits\n";
    }

    $result->free( );
    $db->disconnect( );
  
  








Related examples in the same category

1.Advanced PEAR::DB: Prepared Statements
2.Quick PEAR::DB Calls