Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

mysql syntax error?

mysql php INSERT file_upload



7:23 pm on Nov 9, 2010 (gmt 0)

Can anyone see what my error is here? I am seeing double over this ....


//This is the directory where images will be saved
$target = "images/"; $target = $target . basename( $_FILES['pic']['name']);
//This gets all the other information from the form
$obit_id=$_POST['obit_id']; $first_name=$_POST['first_name']; $last_name=$_POST['last_name']; $age=$_POST['age']; $dob=$_POST['dob']; $dod=$_POST['dod']; $obit_text=$_POST['obit_text']; $photox=($_FILES['pic']['name']);
$con = mysql_connect("#*$!.xx.#*$!.x","#*$!#*$!","#*$!#*$!");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("foxfuneralho", $con);
mysql_query ("INSERT INTO 'obits' VALUES ('$obit_id', '$first_name', '$last_name', '$age', '$dob', '$dod', '$obit_text', '$photox')");
//Writes the photo to the server
if(move_uploaded_file($_FILES['pic']['tmp_name'], $target)) {
//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). basename( $_FILES['pic']['name']). " has been uploaded and your information has been added to the obituary system."; }
else {
//Gives and error if its not
echo "We could not upload this file.";




7:39 pm on Nov 9, 2010 (gmt 0)

mysql_query ("INSERT INTO obits VALUES ('$obit_id', '$first_name', '$last_name', '$age', '$dob', '$dod', '$obit_text', '$photox')");

I believe I solved it ..... removed the single quotes from the table name and I closed the db connection too.


Thanks, but alway love feedback!

Featured Threads

Hot Threads This Week

Hot Threads This Month