homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

mysql syntax error?
mysql php INSERT file_upload

Msg#: 4228563 posted 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.";





Msg#: 4228563 posted 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!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved