geebo Posted November 11, 2007 Share Posted November 11, 2007 I would like to post from a .swf form to a simple MySQL database. I have successfully used php to post to an email, but I am stumped on posting to a database. Here is my php script, which I developed after working through a tutorial: <?php $name=$HTTP_POST_VARS['Name']; $date=$HTTP_POST_VARS['Date_']; $comments=$HTTP_POST_VARS['Comments']; $username="garyboha_*******" $password="*******" $database="garyboha_eortutorial"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); $query = "INSERT INTO eortutorial VALUES(", '$name', '$date', '$comments')"; mysql_close(); ?> I get the following error log message: PHP Parse error: syntax error, unexpected T_VARIABLE in eor.php on line 6 I am sure I am missing something very basic (because I'm not capable of missing anything advanced Thanks in advance for the help. Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted November 11, 2007 Share Posted November 11, 2007 Yuo have to tell the values where to go. i.e.: INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....) Quote Link to comment Share on other sites More sharing options...
geebo Posted November 11, 2007 Author Share Posted November 11, 2007 Thank you tippy_102, but I made the changes you suggested, and I get the same error message. <?php $name=$HTTP_POST_VARS['Name']; $date=$HTTP_POST_VARS['Date_']; $comments=$HTTP_POST_VARS['Comments']; $username="garyboha_*******" $password="*******" $database="garyboha_eortutorial"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); $query = "INSERT INTO eortutorial (index, name, date, comments) VALUES (", '$name', '$date', '$comments')"; mysql_close(); ?> Quote Link to comment Share on other sites More sharing options...
Daukan Posted November 11, 2007 Share Posted November 11, 2007 Missing semi colons $username="garyboha_*******" $password="*******" to $username="garyboha_*******"; $password="*******"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.