Dataobject update during fetch++
| From: | Mike Carter | Date: | Thu, 31 Jul 2003 14:10:02 +0000 |
| Subject: | Dataobject update during fetch++ | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6930@lists.php.net to get a copy of this message | ||
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');
> $totalPeople = $this->find();
>
> while ($this->fetch()) {
> if($mailObj->send($this->email, $hdrs, $body)) {
> echo "{$this->title} {$this->firstname} {$this->surname}
> <{$this->email}><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.
--
http://www.buddasworld.co.uk
----------------------------------------------
This mail sent through http://www.ukonline.net