For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > July 2005 > Re: [PEAR] DB_DataObject multiple deletes









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] DB_DataObject multiple deletes
Justin Patrin

2005-07-27, 5:04 pm

On 7/27/05, Etienne van Tonder <evt@infoware.com.au> wrote:
> Is it possible to perform a delete in a loop using the same DO object, ie
>=20
> foreach ($ridarray as $rid =3D> $val)
> {
> if ($rid > 0)
> {
> if ($fDBTable->get($rid) > 0)
> {
> $fDBTable->delete();
> }
> }
> }


Yes, this should work fine. You should also be able to delete with a
fetch() loop. Are you sure the data is being fetch properly? Try
doing:
DB_DataObject::debugLevel(1);
and watching for errors. You can use up to 5 for more information.
--=20
Justin Patrin
Etienne van Tonder

2005-07-27, 10:00 pm

Hi Justin,

It produces the following error and does not perform the find sql:

Undefined index: data_select

This error is generated in the find function in the following code:

$sql = 'SELECT ' .
$this->_query['data_select'] .
' FROM ' . ($quoteIdentifiers ?
$DB->quoteIdentifier($this->__table) : $this->__table) . " " .
$this->_join .
$this->_query['condition'] . ' '.
$this->_query['group_by'] . ' '.
$this->_query['having'] . ' '.
$this->_query['order_by'] . ' ';

Regards,

Etienne.


"Justin Patrin" <papercrane@gmail.com> wrote in message
news:432beae050727091955040f73@mail.gmail.com...

Yes, this should work fine. You should also be able to delete with a
fetch() loop. Are you sure the data is being fetch properly? Try
doing:
DB_DataObject::debugLevel(1);
and watching for errors. You can use up to 5 for more information.
--
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com