RE: [PHP] Why won`t this delete?

From: Date: Fri, 27 Oct 2000 23:37:37 +0000
Subject: RE: [PHP] Why won`t this delete?
Groups: php.general 
Request: Send a blank email to php-general+get-22395@lists.php.net to get a copy of this message
This does not apply to SQL Statements, however. If you wish to be SQL-92 Compliant, try this. $Updstmt = "DELETE * FROM EList1 WHERE Email='$Email'"; SQL-92 Specifications require single quotes on a string comparison. Double equal signs in PHP is an equality statement, but this does not apply to SQL. Happy Coding, Joseph M. Ferris joseph.ferris@cdicorp.com Senior Programmer / Analyst CDI Corporation, TDC. http://www.cdicorp.com -----Original Message----- From: Sander, Ryan [mailto:ryan.sander@cantonrep.com] Sent: Friday, October 27, 2000 10:39 AM To: 'Website4S@aol.com'; 'php-general@lists.php.net' Subject: RE: [PHP] Why won`t this delete? Regarding this line of code: > $Updstmt="delete from EList1 where Email=\"$Email\""; > Try this instead > $Updstmt="delete from EList1 where Email==\"$Email\""; > When you use a single equals sign (=) you are setting the value on the left equal to the value on the right. When you use the doubel euals (==) you are actually telling it to compare the two. Hope that's it. good luck, Ryan Sander Web Developer 330-580-8549 Ryan.Sander@cantonrep.com http://cantonrep.com > ---------- > From: Website4S@aol.com > Sent: Friday, October 27, 2000 12:19 PM > To: php-general@lists.php.net > Subject: [PHP] Why won`t this delete? > > Hi, > > I have a basic if statement but for some reason it just won`t delete, any > ideas what I`ve done wrong? I have a table called EList1 which has one > field > called Email varchar(50) I know the form is working ok because it allows > me > to add but not remove. > > if ($Selection=="unsubscribe"){ > > $Updstmt="delete from EList1 where Email=\"$Email\""; > > $SQLConn = mysql_connect("", "", "") or die ("Could not > connect to > database"); > $db = mysql_select_db("f199102", $SQLConn) or die ("Couldn`t select > database"); > > $query_delete=mysql_db_query($db, $Updstmt); > > if (!$query_delete){ > echo "Couldn`t Delete"; > } > > mysql_close ($SQLConn); > > printf("<SCRIPT LANGUAGE='JAVASCRIPT'>alert('You have been removed > from > > the mailing list.');self.history.back();</SCRIPT>"); > } > > > Thanks in advance > > Adrian > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net _____________________________________________________________________ This message has been checked for all known viruses by UUNET delivered through the MessageLabs Virus Control Centre. For further information visit http://www.uk.uu.net/products/security/virus/

« previous php.general (#22395) next »