Ok, this is so weird!!! I am running PHP Version 5.1.6 when I try and run the code below it gives a fatal error of an object that has not been instantiated. As soon as I un-comment this line of code //$cb_db = new cb_db(USER, PASSWORD, NAME, HOST); everything works. Even though I have declared the $cb_db object as global within in the method. Any help would be greatly appreciated.
require_once (ROOT_CB_CLASSES 'db.php'.);
$cb_db = new cb_db(USER, PASSWORD, NAME, HOST);
class cb_user {
protected function find_by_sql( $sql ) {
global $cb_db;
//$cb_db = new cb_db(USER, PASSWORD, NAME, HOST);
$result_set = $cb_db->query( $sql );
$object_array = array();
while( $row = $cb_db->fetch_array( $result_set ) ) {
$object_array[] = self::instantiate( $row );
}
return $object_array;
}
}