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.
Code:
<html> <head> <title>MYSQL Affected Rows Example In PHP</title> <style type="text/css"> body { width: 980px; margin: 0px auto; text-align: center; padding-top: 50px; font-size: 20px; } </style> </head> <body> <h2>MYSQL Affected Rows Example In PHP</h2> <br><br> <?php $con = mysql_connect("localhost", "root", "") or die ("Could not connect"); if($con) // 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()); mysql_query("COMMIT"); ?> </body> </html>