Re: Submitting data to MySQL database using HTML/PHP form

From: Date: Sun, 20 Feb 2011 21:43:50 +0000
Subject: Re: Submitting data to MySQL database using HTML/PHP form
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-47689@lists.php.net to get a copy of this message
Daniel Brown wrote:
On Sun, Feb 20, 2011 at 14:11, Nazish Zafar<nazish@jhu.edu> wrote:
$insert = "INSERT INTO user_info (login, password) VALUES ("$login", "$password");
     You're using double-quotes to encapsulate your $insert variable
data, then never closing them. What's more, you're also using double-quotes to encapsulate each individual variable in the query. Rewrite $insert to this:
         $insert = "INSERT INTO user_info(login,password)
VALUES('".mysql_real_escape_string($login)."',"'.mysql_real_escape_string($password)."')";
Look at that one more time Dan. ;-) Donovan -- D Brooke

« previous php.db (#47689) next »