I’m trying to add some info to my database via a form. I’ve done this int he past with no issues, but for some reason I’m having a major brain fart and it stinks.
Here’s my PHP:
[code=php]
//Connect to Database
$con = mysql_connect(“localhost:8888″,”root”,”root”);
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_select_db(“toronto_****burns”, $con);
//Add Variables Condition
if ($_GET[‘formUpload’] == 1) {
//Gather variables from Form
$firstName = $_POST[‘first_name’];
$secondName = $_POST[‘second_name’];
$lastName = $_POST[‘last_name’];
$birthDate = $_POST[‘birth’];
$deathDate = $_POST[‘death’];
$genNum = “”;
$picURL = “”;
$email = “”;
//Add variables to Database
$addMember = mysql_query(“INSERT INTO family (first_name, second_name, last_name, birth_date, death_date)
VALUES (‘$firstName’, ‘$secondName’, ‘$lastName’, ‘$birthDate’, ‘$deathDate'”);
if (!mysql_query($addMember,$con)) {
die(‘Error: ‘ . mysql_error());
}
echo “1 record added”;
//echo “” . $firstName . ” ” . $secondName . ” ” . $lastName . ” was born in ” . $birthDate . ” and died in ” . $deathDate;
}
For some reason I keep getting “Error: Query was empty”. I’ve tried using $_POST[‘first_name’], etc instead of straight variables and nothing changes.
Any ideas? Need to see more? let me know.
Thanks!