Re: Dataobject update during fetch++

From: Date: Fri, 01 Aug 2003 02:05:37 +0000
Subject: Re: Dataobject update during fetch++
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6937@lists.php.net to get a copy of this message
Mike Carter wrote:
Sorry about this, my webmail went and sent the email before I was finished. Have added the additional message to the end of this one. Thanks.
I'm attempting to loop through a table of records and update each record with a new value in one of its fields. However this is causing a DataObject error: 3 got keys as a:1:{i:0;s:2:"id";} ERROR update: No Data specifed for query title = 'Mr' , surname = 'Carter' , firstname = 'Mike' , email = 'mcarter@quantiv.com' , emailack = 1059659875 , update: No Data specifed for query title = 'Mr' , surname = 'Carter' , firstname = 'Mike' , email = 'mcarter@quantiv.com' , emailack = 1059659875 , My code goes as follows: // --- Only extract the columns we need for this email spam $this->selectAdd(); $this->selectAdd('email,title,firstname,surname,emailack');
you need to add id to this, otherwise it cant update based on a key that it has..
$totalPeople = $this->find(); while ($this->fetch()) { if($mailObj->send($this->email, $hdrs, $body)) { echo "{$this->title} {$this->firstname} {$this->surname} &lt;{$this->email}&gt;<br>"; $this->emailack = time(); if(!$this->update()) { echo $this->_lastError->getMessage(); } }
I have DB_DataObject::debugLevel(5); set and it doesn't show me the update() query being built by DataObjects(!) is this correct? I'm using the following PEAR class versions: // $Id: DB.php,v 1.22 2003/06/11 19:06:19 cox Exp $ * $Id: DataObject.php,v 1.115 2003/07/31 04:58:53 alan_k Exp $ Running with MySQL/PHP4 on a Windows box. Regards, Mike C.


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