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

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.