Lodius2000 Posted October 20, 2008 Share Posted October 20, 2008 ok guys, I need some fresh eyes by commenting out 1 query at a time, I have found out that the first query below is the one with the problem, I have also included the second one because it has the same structure and works like a charm, I have also print_r-ed all the variables in the first query, they are correct please help me find what is wrong here doesnt work: $db->query('INSERT INTO entries (article_id, timestamp, article_title, article, order, username, email) VALUES(?,?,?,?,?,?,?)', array($article_id, $timestamp, $title, $article, $new_order, $real_name, $email)); works: $db->query('INSERT INTO image (id, article_id, image_url, thumb_url, image_caption) VALUES(?,?,?,?,?)', array($image_id, $article_id, $image_url, $thumb_url, $caption)); i use peardb, which supports place-holders, hence all the ?,?,?,?,?,?,?,? thank you Quote Link to comment https://forums.phpfreaks.com/topic/129161-solved-db-error-syntax-error-aaaaarg/ Share on other sites More sharing options...
AndyB Posted October 20, 2008 Share Posted October 20, 2008 order is a MySQL reserved word. You can't use them as field names or table names. http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html Either change the field name or add `backticks` as a cheap work-around. Quote Link to comment https://forums.phpfreaks.com/topic/129161-solved-db-error-syntax-error-aaaaarg/#findComment-669645 Share on other sites More sharing options...
Lodius2000 Posted October 20, 2008 Author Share Posted October 20, 2008 andy, you are completely right, thanks so much, changed order to imgorder and all is well Quote Link to comment https://forums.phpfreaks.com/topic/129161-solved-db-error-syntax-error-aaaaarg/#findComment-669650 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.