note 13035 deleted from function.mysql-affected-rows.php by zak

From: Date: Wed, 20 Jun 2001 10:45:04 +0000
Subject: note 13035 deleted from function.mysql-affected-rows.php by zak
Groups: php.notes 
Request: Send a blank email to php-notes+get-14485@lists.php.net to get a copy of this message
this is a small program written by me to show how the delete function should be performed .the $realname and $username are the two values that have come here by a post operation from an another program. than use the values to find out if there is any data that match these values and than deleting the data. sultan zahir khan --------------------- <html><head></head> <body bgcolor="#FAEBD7"> <? $connection = mysql_connect("localhost","sultan","qwerty") or die ("Unable to connect to MySQL server."); mysql_select_db("sultan2",$connection) or die ("Unable to select requested database."); $deleteresult = mysql_query ("DELETE FROM users WHERE real_name = '$real_name' AND username = '$username'"); $result=mysql_query($deleteresult, $connection); $affected_rows=mysql_affected_rows($connection); if ($affected_rows == -1) { echo "<b>$username</b> was probably deleted sucessfully.";} else { echo "<b>$username</b> was not probably deleted sucessfully.";} ?> </body></html>

« previous php.notes (#14485) next »