Re: Help with DB.php in PHP5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Info@Best-It wrote:
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


hi : DB::connect MUST be static . such as: class DB { public static connect(){} public $disconnect; } I think you can only use DB::disconnect to access constant not variable

--
-- ShenKong (shenkong@xxxxxxx)
-- http://www.openphp.cn

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux