sean14592 Posted December 6, 2008 Share Posted December 6, 2008 Hi. Ok, well Im getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc) VALUES ('NULL','hi','yes','5','whc493ad286a3f2f.jpg','whc493ad286a4039.jpg' at line 1 My code is this: //upload image $newname = uniqid("whc").".jpg"; move_uploaded_file($_FILES['image_thum']['tmp_name'], "../images/templates/$newname"); //upload image $newname2 = uniqid("whc").".jpg"; move_uploaded_file($_FILES['full_image']['tmp_name'], "../images/templates/$newname2"); mysql_connect(*********,*********,*********) or die(mysql_error()); mysql_select_db(*********) or die(mysql_error()); $name = $_POST['name']; $members = $_POST['members']; $cat = $_POST['cat']; $desc = $_POST['desc_main']; // Insert a row of information into the table mysql_query(" INSERT INTO templates (id, name, members, cat, image_thum, full_image, desc) VALUES ('NULL','$name','$members','$cat','$newname','$newname2','$desc') ") or die(mysql_error()); echo "complete"; Cheers Sean Quote Link to comment https://forums.phpfreaks.com/topic/135827-solved-need-help-with-php-mysql-insert/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 6, 2008 Share Posted December 6, 2008 http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html desc is a reserved mysql word. To avoid all possible problems, change to something else and don't use reserved words are table or column names. Quote Link to comment https://forums.phpfreaks.com/topic/135827-solved-need-help-with-php-mysql-insert/#findComment-707992 Share on other sites More sharing options...
sean14592 Posted December 6, 2008 Author Share Posted December 6, 2008 Thanks man! Works like a charm. Have a good XMAS! Quote Link to comment https://forums.phpfreaks.com/topic/135827-solved-need-help-with-php-mysql-insert/#findComment-708003 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.