homepage Welcome to WebmasterWorld Guest from 54.204.94.228
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
mysql syntax error?
mysql php INSERT file_upload
highseas




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

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

<?php

//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.";
}

?>

Thanks!

 

highseas




msg:4228571
 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.

mysql_close($con);


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