note 34189 deleted from function.msql-affected-rows by didou
| From: | didou@php.net | Date: | Tue, 30 Sep 2003 07:42:29 +0000 |
| Subject: | note 34189 deleted from function.msql-affected-rows by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57380@lists.php.net to get a copy of this message | ||
Note Submitter: riccardobarioglio4@tin.it
----
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);
?>