mysql_affected_rows example php

mysql_affected_rows example php

In this post we will learn how to use MYSQL Affected Rows Example In PHP.
mysql_affected_rows() functions returns the number of rows affected by the last query (INSERT, UPDATE or DELETE) associated with link_identifier, this should be called before commit.


<title>MYSQL Affected Rows Example In PHP</title>
<style type="text/css">
 width: 980px;
 margin: 0px auto;
 text-align: center;
 padding-top: 50px;
 font-size: 20px;
<h2>MYSQL Affected Rows Example In PHP</h2>
$con = mysql_connect("localhost", "root", "")
or die ("Could not connect");

// Select the database
mysql_select_db ("mycreation",$con);

// Query to Update records
mysql_query("UPDATE menu SET menu_name='About Us' WHERE menu_id > 1",$con);
printf ("Updated records: %d\n", mysql_affected_rows());