note 34500 added to function.msql-affected-rows
| From: | info at letrioperdu dot net | Date: | Tue, 29 Jul 2003 12:04:18 +0000 |
| Subject: | note 34500 added to function.msql-affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52920@lists.php.net to get a copy of this message | ||
I tried this but it did not work. I always get this error : "Supplied argument is not a valid
MySQL-Link resource"
That's why I used the link_identifier instead of the query_identifier and that does work.
Hope this solves somebody's problem like it solved mine.
<?php
// Connect to database server
$hd = mysql_connect("localhost", "USER","PASS")
or die ("Unable to connect");
// Execute sample query (UPDATE some data in customer table)
$res = mysql_query("UPDATE customer SET type=1",$hd)
or die ("Unable to run query");
// Display number of rows affected
// And here I had to use the link_identifier
echo "Rows deleted: " . mysql_affected_rows($hd);
// 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+34500
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34500&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34500&report=yes