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( );
|