Wstar Posted February 3, 2010 Share Posted February 3, 2010 Having some issues with an error. Its just a simple query, yet I can't figure it out. MySQL Version: 5.0 MySQL Statement: $query = "INSERT INTO invoices (invoice_number, date, total, first_name, last_name, email, address, post_code, state, order, comments) VALUES ('$invoice', '$date', '$total', '$first', '$last', '$email', '$address', '$zip', '$state', '$order', 'N')"; MySQL Error: INSERT INTO invoices (invoice_number, date, total, first_name, last_name, email, address, post_code, state, order, comments) VALUES ('1', 'February 3, 2010, 9:15 am', '4.95', 'Jerrod', 'Davenport', 'jerr', '404 E Vernon, Apt A3', '61761', 'IL', 'a:2:{i:0;N;i:1;a:7:{s:10:"product_id";s:1:"1";s:8:"quantity";s:1:"1";s:4:"name";s:18:"The Last Ute Cheif";s:5:"cover";s:1:"p";s:9:"unitPrice";s:5:"15.00";s:6:"extra1";s:0:"";s:6:"extra2";s:0:"";}}', 'N') 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, comments) VALUES ('1', 'February 3, 2010, 9:15 am', '4.95'' at line 2 I can't find any problem. Please, any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/190802-simple-query-error/ Share on other sites More sharing options...
ahs10 Posted February 3, 2010 Share Posted February 3, 2010 put ticks around your column names.... INSERT INTO invoices (`invoice_number`, `date`, `total`, `first_name`, `last_name`, `email`, `address`, `post_code`, `state`, `order`, `comments` it's messing up at the order because that is a sql command, it thinks your telling it to sort information, not providing a column name. Quote Link to comment https://forums.phpfreaks.com/topic/190802-simple-query-error/#findComment-1006130 Share on other sites More sharing options...
Wstar Posted February 3, 2010 Author Share Posted February 3, 2010 You are correct! Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/190802-simple-query-error/#findComment-1006215 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.