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. Link to comment https://forums.phpfreaks.com/topic/76872-solved-simple-php-mysql-question/ 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,....) Link to comment https://forums.phpfreaks.com/topic/76872-solved-simple-php-mysql-question/#findComment-389194 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(); ?> Link to comment https://forums.phpfreaks.com/topic/76872-solved-simple-php-mysql-question/#findComment-389200 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="*******"; Link to comment https://forums.phpfreaks.com/topic/76872-solved-simple-php-mysql-question/#findComment-389202 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.