|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #28526 Add 'dbx_num_affected_rows' function
Submitted: 2004-05-26 13:43 UTC Modified: 2017-08-23 00:24 UTC
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: johnw at sussex dot ac dot uk Assigned: kalle (profile)
Status: Closed Package: DBX related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
29 + 16 = ?
Subscribe to this entry?

 [2004-05-26 13:43 UTC] johnw at sussex dot ac dot uk
It would be very useful (to me at least) if the dbx 
module included a function for returning the number of 
rows affected by an INSERT, UPDATE, or DELETE statement.

Implementation suggestion: the function DBX_QUERY could
call the relevant database-specific function after an
update/insert/delete and save the result in the link
identifier object. A new function DBX_NUM_AFFECTED_ROWS
would retrieve this saved value from the link 

Possibly a select query would cause the 
'num_affected_rows' value to be set to 0, for neatness.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-08 14:35 UTC]
While waiting for someone to actually implement this, the following snippet (untested) might be useful:

$link = dbx_connect(DBX_MYSQL, "localhost", "db", "username", "password");
$result = dbx_query($link, "DELETE FROM table WHERE name=''");
echo mysql_affected_rows($link->handle);

 [2004-06-10 00:54 UTC] johnw at sussex dot ac dot uk
Thanks for the suggestion but unfortunately I am using 
Oracle (OCI8) where the 'native' function for getting 
the number of affected rows needs to be applied to the 
statement handle returned by OCIParse, not the 
connection handle returned by OCILogon.
 [2004-06-10 09:47 UTC]
Luckily, there is also a $result->handle that you can use :-)
 [2016-12-30 19:00 UTC]
-Package: Feature/Change Request +Package: DBX related
 [2017-08-23 00:24 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2017-08-23 00:24 UTC]
Gonna close this as the DBX package has no activity, if an active maintainer takes it over then please re-open
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Mar 22 07:03:39 2023 UTC