Okay this should be something fairly easy, but due to my lack of experience I am having a lot of trouble. I am receiving the following error when I submit the information in my form to a page called insert.php
Error: 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 'From, Comments) Values ('','','')' at line 1
here is the code I have for the insert.php
<?php
$con = mysql_connect(" mysql3.freehost ia.com","ammloc _posts","sumner 20");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("ammloc_posts" , $con);
$sql="insert into two_fridas (Subject, From, Comments)
Values ('$_post[subject]','$_post[from]','$_post[comments]')";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thank you, your comment has been added.";
mysql_close($co n);
?>
You may also see first hand what it looks like at http://humanities1100. freehostia.com/fridas.html and then just fill out the form and submit.
any help would be greatly appreciated. thank you in advance
Error: 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 'From, Comments) Values ('','','')' at line 1
here is the code I have for the insert.php
<?php
$con = mysql_connect(" mysql3.freehost ia.com","ammloc _posts","sumner 20");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("ammloc_posts" , $con);
$sql="insert into two_fridas (Subject, From, Comments)
Values ('$_post[subject]','$_post[from]','$_post[comments]')";
if (!mysql_query($ sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thank you, your comment has been added.";
mysql_close($co n);
?>
You may also see first hand what it looks like at http://humanities1100. freehostia.com/fridas.html and then just fill out the form and submit.
any help would be greatly appreciated. thank you in advance
Comment