How to use mysql affected row in PHP
In this article I am going to explain about mysql_affected_row function in PHP.
PHP mysql_affected_rows() Function
The PHP mysql_affected_rows function returns number of affected row in previous operation.
Syntax of mysql_affected_rows function
mysql_affected_rows(connection) |
Parameters in mysql_affected_rows function
It has only one parameter:
Parameter |
Description |
connection |
It specifies mysql connection. |
Example of mysql_affected_rows function
<html>
<body>
<?php
$con=mysql_connect("localhost","gupta","sharad");
if(!$con)
{
die("Could not connect:". mysql_error());
}
mysql_select_db("Mcn_Solution", $con);
mysql_query("delete from emp where Id=105");
$resqry=mysql_affected_rows();
echo "Total no of records deleted:".$resqry;
mysql_close($con);
?>
</body>
</html>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here