CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Function to know number of affected records or rows (PHP example)

Print topic Send  topic

Author Message
Gena

Posts: 591
Posted: 03/21/2011, 11:01 AM

We are often interested to know how many records the query affected or updated when you use direct DB operation. The function affected_rows() will return the number of rows or records affected by any update, insert or delete query.

For example, if you UPDATE some table you can use following code:
  
$dbr = new clsDBmydatabaseDB();    
$rate = 1.5;  
$SQLr = "update ProductPrice set ProductPriceRate=" . $rate . " where ProductPriceCurrency='USD'" ;    
$dbr->query($SQLr);   
$num = $dbr->affected_rows() ; //  $num contains number of affected records  
  
$dbr->close();  

_________________
Gena
View profile  Send private message
jjrjr2


Posts: 131
Posted: 03/21/2011, 6:43 PM

Great Tip..

Thanks Gena
:-) :-)
_________________
John Real - More CodeCharge Studio Support at - http://CCSElite.com
Real Web Development At: http://RealWebDevelopment.us
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.