Re: DB_DataObject - get()

From: Date: Wed, 13 Aug 2003 02:54:23 +0000
Subject: Re: DB_DataObject - get()
References: 1  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-7173@lists.php.net to get a copy of this message
Barry Steele wrote:
Hi, I've just run into a strange inconsistenct with DB_DataObject I have the following code:- $user = new DataObject_Users;
          echo "Looking for [".$_COOKIE['USERNAME']."]<br>";
         $user = new DataObject_Users;
         $user->debugLevel(5);
         $user->get('username',$_COOKIE['USERNAME']);
if $_COOKIE['USERNAME'] is not set, it will assign the second var to 'null', which is tested for in the get statement.. , so it assumes you are searching for 'username' in the primary key column .. if you dont have one assigned it will fail to produce a query... you could try ''.$_COOKIE['USERNAME'] I've made a slight change to cvs to use count(func_get_args()), rather than === null.. -see if that makes a difference.. Regards Alan
Which works wonderfully well on my development machine but on the target server it produces a query statement without a where clause. I've just upgraded DB_DataObject on both machines to 1.1 and it still occurrs. For the moment I'm going to get around it by using find and fetch, but I'm really interested to understand why I get different behavours on the two machines. Any thoughts? Barry


« previous php.pear.general (#7173) next »