Re: DB : affectedRows() on an UPDATE query ?
| From: | (Stig Sæther Bakken) | Date: | Sun, 05 Aug 2001 20:51:28 +0000 |
| Subject: | Re: DB : affectedRows() on an UPDATE query ? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1310@lists.php.net to get a copy of this message | ||
["Tomas V.V.Cox" <cox@idecnet.com>]
> Sylvinus Prodi wrote:
> >
> > Hello all,
> >
> > It would be great to allow an affectedRows() (returning a DB_Result instead
> > of a DB_OK) with UPDATE or DELETE queries !
>
> affectedRows() works only with UPDATES/INSERT/DELETE queries.
>
> $db->query('delete * from users');
> echo "I have deleted " . $db->affectedRows() . " users";
Please note that for "delete from users" DB_mysql::affectedRows won't
give you what you expect unless you set the "optimize" option to
"portability" for that DB connection.
- Stig
--
Stig Sæther Bakken <ssb@alltheweb.com>
Fast Search & Transfer ASA, Trondheim, Norway