PDA

View Full Version : problem with INSERT


matyee
02-27-2002, 09:26 PM
Hi guys,

I'm having a bit of trouble inserting data into the database. I'm not sure if it's my actual insert statement or if it is that I'm not properly connected to the database. I'm just trying to enter a an email address (string) into the database.

Here's my code:

$dbh = mysql_connect ("localhost", "username", "password") or die("Could not open connection to DB server.");
mysql_select_db("database_name", $dbh) or die("Could not select the database.");

$query = "INSERT INTO survey_email VALUES ('$email')";
$result = mysql_query($query, $dbh) or die("Insert failed");

I keep getting that the die statement that my insert failed.

If you have any ideas please let me know.

Thanks

matyee
02-28-2002, 03:41 AM
I was just missing a semicolon at the end of the query. bleh!