mysql_affected_rows() returns the number of rows affected by an SQL query involving an INSERT, UPDATE, REPLACE, or DELETE. : mysql_affected_row « MySQL Database « PHP






mysql_affected_rows() returns the number of rows affected by an SQL query involving an INSERT, UPDATE, REPLACE, or DELETE.

 
Its syntax is: int mysql_affected_rows ([int link_id])

<?
@mysql_connect("localhost", "root","") or die("Could not connect to MySQL server!");
@mysql_select_db("mydatabase") or die("Could not select database!");
$query = "UPDATE mytable SET title = \"aaa\" WHERE id = 1";
$result = mysql_query($query);
print "Total row updated: ".mysql_affected_rows();
mysql_close();
?>
  
  








Related examples in the same category