dfowler Posted January 15, 2012 Share Posted January 15, 2012 Hey guys, I have a database of DVDs that I am building a CMS system to handle. I'm currently getting an error with an update statement that is built on the edit portion of the CMS. The table setup is as follow: Column Type Collation Attributes Null Default Extra id int(10) [/td] No None AUTO_INCREMENT title varchar(200) latin1_swedish_ci No year int(5) Yes NULL actors text latin1_swedish_ci Yes NULL genre text latin1_swedish_ci Yes NULL series varchar(200) latin1_swedish_ci Yes false order int(10) Yes 0 img_name varchar(200) latin1_swedish_ci Yes NULL img_location varchar(200) latin1_swedish_ci Yes NULL [td] Here is my statement: UPDATE dvds SET title='American Pie', year='1999', actors='Jason Biggs, Chris Klein, Thomas Ian Nicholas, Eddie Kaye Thomas, Seann William Scott, Alyson Hannigan, Tara Reid, Mena Suvri, Shannon Elizabeth, Natasha Lyonne, Eugene Levy, Molly Cheek, Chris Owen, Jennifer Coolidge, John Cho, James DeBello', genre='teen, comedy', series='American Pie', order='1' WHERE id='13' Here is the error I am seeing: 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 'order='1' WHERE id='13'' at line 1 I have tried redoing the statement removing the quotes from the INT fields. However, still see the same error. I am 100% lost here as I can't see what is wrong at all. I'm sure I am just missing something. Thanks for any help! Quote Link to comment https://forums.phpfreaks.com/topic/255038-error-on-update-what-am-i-not-seeing/ Share on other sites More sharing options...
AyKay47 Posted January 15, 2012 Share Posted January 15, 2012 "order" is a mysql reserved word, and cannot be used in a query unless it is wrapped in back ticks.. series='American Pie',`order`='1' WHERE id='13' http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html Quote Link to comment https://forums.phpfreaks.com/topic/255038-error-on-update-what-am-i-not-seeing/#findComment-1307725 Share on other sites More sharing options...
dfowler Posted January 15, 2012 Author Share Posted January 15, 2012 Thank you so much! I knew I was overlooking something. I always forget about the reserved words. Quote Link to comment https://forums.phpfreaks.com/topic/255038-error-on-update-what-am-i-not-seeing/#findComment-1307729 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.