[Solved] Inserting into a database an email address
Posted: Mon Jun 26, 2006 2:29 pm
Ok so i'm using a basic bog standard form:Simple yeah?
Now this is what i'm using to insert the code to the database on mail.php:Now whenever I I enter something in the email address form and click the "Add Email" button I always get this error:
Code: Select all
<form action="mail.php" method="POST">
Email: <input type="text" name="email" size="60"><br>
<input type="submit" value="Add Email">
</form>Now this is what i'm using to insert the code to the database on mail.php:
Code: Select all
<?php
$conn = mysql_connect("localhost", "USERNAME", "PASSWORD");
mysql_select_db("DATABASE", $conn) or die(mysql_error());
$sql1 = "INSERT INTO mailing VALUES('',$_POST[email])";
$result1 = mysql_query($sql1, $conn) or die(mysql_error());
?>Any reason why??You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@gmail.com)' at line 1