Jump to content

[SOLVED] Simple PHP MySQL Question


geebo

Recommended Posts

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  :D

 

Thanks in advance for the help.

 

Link to comment
https://forums.phpfreaks.com/topic/76872-solved-simple-php-mysql-question/
Share on other sites

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();

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.