Re: Submitting data to MySQL database using HTML/PHP form
| From: | Daniel Brown | Date: | Sun, 20 Feb 2011 19:26:45 +0000 |
| Subject: | Re: Submitting data to MySQL database using HTML/PHP form | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47687@lists.php.net to get a copy of this message | ||
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)."')";
--
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/