note 34189 added to function.msql-affected-rows
| From: | riccardobarioglio4 at tin dot it | Date: | Thu, 17 Jul 2003 22:59:42 +0000 |
| Subject: | note 34189 added to function.msql-affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52302@lists.php.net to get a copy of this message | ||
In the upper example, $hd is a valid connection handle. And $res is the target variable for
receiving rowset handle. In case of DELETE, INSERT or UPDATE statements usage, $res receives
miscellaneous information handle. To show how to work with such handles, a slightly modified table
clearing example is provided below:
<?php
// Connect to database server
$hd = mysql_connect("localhost", "george",
"georgespassword9798")
or die ("Unable to connect");
// Execute sample query (delete all data in customer table)
$res = mysql_query("DELETE FROM andrewsbase.customer",$hd)
or die ("Unable to run query");
// Display number of rows affected
echo "Rows deleted: " . mysql_affected_rows($res);
// Close connection
mysql_close($hd);
?>
----
Manual Page -- http://www.php.net/manual/en/function.msql-affected-rows.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34189
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34189&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34189&report=yes