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