I’m writing my first PHP program using the O’Reilly “Learning PHP 5” book. I am trying to use the Pear DB functions and getting the following errors:
Notice: Only variable references should be returned by reference in /usr/lib/php/DB/common.php on line 501
Fatal error: Call to undefined function: numrows() in /home/jdvetcom/public_html/qEventsPHP.php on line 17
The PHP part of my code is below:
<?php
error_reporting(E_ALL);
require_once ‘DB.php’;
$db = DB::connect(“mysql://xxx:yyy@localhost/zzz”);
if (DB::isError($db)) {die("can’t connect: " . $db->getMessage());}
$q = $db->query(“SELECT * FROM event”);
print “there are " . $q->numrows() . " in event table”;
?>
The fact that numrows() is undefined make me wonder if the Pear DB functions are supported on my server. My questions are: did I code this wrong? Is there an easy way to see if Pear DB is installed?