Help with DB.php in PHP5
| From: | Info@Best-IT | Date: | Mon, 29 Nov 2004 01:02:13 +0000 |
| Subject: | Help with DB.php in PHP5 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203038@lists.php.net to get a copy of this message | ||
I upgraded to PHP 5 and now I am having some problems with DB.php.
2 problems:
1. I get this notice
Notice: Undefined property: DB_mysql::$disconnect
2: the $db->query no longer works. I have gone as far as to place this line
at the beginning of the file:
set_include_path(".:/usr/local/lib/php"); //this is where DB.php resides. I
also have QueryTool in the DB directory in this path.
Here is my code:
function db_connect($sql)
{
global $dsn;
$db = DB::connect($dsn, TRUE);
$r = $db->query($sql);
if(DB::isError($db)){
die($db->getMessage());
} else {
$success = true;
}//end if
$s = array();
$i =0;
if($success){
while($data = mysql_fetch_assoc($r->result)){
$i++;
array_push($s, $data);
}
$i =0;
$db->disconnect;
} else {
die("Query for content failed.");
}
return $s;
}
Thanks for your help!
Tim