ted_chou12 Posted August 31, 2012 Share Posted August 31, 2012 Hi, I am trying to get sql to work and inster by querying several statements thru php: INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('1', '1', '', '0', '0', 's1' , '3' , '1-2,2-4' , '' , '0', '0', '', '2009-05-27 23:37:38', '0000-00-00 00:00:00', '2' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('2', '1', '', '0', '0', 's4' , '3' , '1-2' , '' , '0', '0', '', '2009-05-13 23:40:51', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('9', '0', 'choui', '2147483647', '0', '' , '0' , '1-1,2-2' , '' , '5', '0', '0', '2009-06-01 14:11:59', '2009-06-06 01:55:03', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('6', '1', '', '0', '0', 'T1' , '0' , '1-1' , '' , '6', '0', '', '2009-06-01 09:20:51', '0000-00-00 00:00:00', '0' , 'yes! ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('5', '0', 'alibaba', '5204992222', '0', '' , '0' , '1-4,2-2' , '' , '0', '0', '0', '2009-06-01 09:19:13', '2009-06-06 01:55:44', '4' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('7', '1', '', '0', '0', 'T2' , '11' , '1-1,2-2' , '' , '5', '0', '', '2009-06-01 09:21:29', '2009-06-01 14:21:45', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('8', '0', 'ted', '0', '0', '' , '0' , '1-2,2-3' , '' , '0', '0', '', '2009-06-01 11:27:23', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('10', '1', '', '0', '0', 'S1' , '9' , '1-4' , '' , '0', '0', '', '2009-06-02 08:26:41', '0000-00-00 00:00:00', '3' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('11', '1', '', '0', '0', 'S1' , '9' , '1-4' , '' , '0', '0', '', '2009-06-02 08:26:41', '0000-00-00 00:00:00', '1' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('12', '1', '', '0', '0', 'S4' , '2' , '2-2,3-4' , '' , '5', '0', '', '2009-06-03 11:20:53', '0000-00-00 00:00:00', '2' , 'B-day coupon ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('13', '0', 'Ted', '52044923', '0', '' , '0' , '2-2' , '' , '3', '0', '0', '2009-06-04 13:09:08', '2009-06-06 01:44:38', '3' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('14', '1', '', '0', '0', '1/2' , '2' , '2-2,3-1' , '' , '5', '0', '0', '2009-06-05 20:44:26', '2009-06-05 22:18:43', '2' , 'B-day coupon ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('15', '1', '', '0', '0', 'T1' , '3' , '1-1' , '' , '10', '0', '1', '2009-06-05 22:36:21', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('16', '1', '', '0', '0', 'T1' , '3' , '2-2,3-1' , '' , '5', '0', '0,1', '2009-06-05 22:36:30', '2009-06-05 22:43:35', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('17', '1', '', '0', '0', 'T1' , '3' , '1-1,2-1,3-1,5-1' , '' , '10', '0', '0,3', '2009-06-05 22:36:38', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('18', '0', 'Test', '2147483647', '0', '' , '0' , '1-2' , '' , '0', '0', '0', '2009-06-06 01:46:05', '2009-06-06 01:50:43', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('19', '0', 'Ted', '9184881911', '0', '' , '0' , '1-2' , '' , '5', '0', '3', '2009-06-06 02:00:32', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('20', '1', '', '', '0', '2/1' , '5' , '2-2,3-3' , '' , '7', '0', '0', '2009-06-06 02:00:58', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('21', '1', '', '', '0', '3/4' , '5' , '2-4' , '' , '0', '0', '', '2009-06-06 02:01:16', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('22', '1', '', '', '0', '5/4' , '2' , '3-2' , '' , '0', '0', '', '2009-06-06 02:01:29', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('23', '0', 'ali', '1294109410', '0', '' , '0' , '1-2,2-3' , '' , '5', '0', '0', '2009-06-06 02:01:56', '0000-00-00 00:00:00', '4' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('24', '1', '', '', '0', '1/2' , '2' , '1-3' , '' , '5', '0', '0', '2009-06-06 18:00:30', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('25', '1', '', '', '0', '1/2' , '2' , '1-4,2-2,3-3,6-6' , '' , '5', '0', '0,1', '2009-06-06 18:06:07', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('26', '1', '', '', '0', '1/2' , '2' , '1-4,2-2,3-3,6-6' , '' , '5', '0', '3', '2009-06-06 18:06:22', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('27', '1', '', '', '0', '1/2' , '2' , '1-1,2-1,6-1' , '' , '5', '0', '2', '2009-06-06 18:08:16', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('28', '1', '', '', '2', '1/2' , '2' , '1-1,2-1,6-1' , '' , '5', '0', '1', '2009-06-06 18:13:39', '2009-06-07 22:59:57', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('29', '1', '', '', '0', '1/2' , '2' , '2-1' , '' , '5', '0', '0', '2009-06-06 18:14:12', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('30', '1', '', '', '0', '1/2' , '2' , '1-3' , '' , '5', '0', '0', '2009-06-06 18:14:38', '0000-00-00 00:00:00', '1' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('31', '1', '', '', '0', '1/2' , '2' , '6-4' , '' , '5', '0', '0', '2009-06-06 18:14:58', '0000-00-00 00:00:00', '5' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('32', '1', '', '', '0', '2/5' , '0' , '2-1' , '' , '0', '0', '', '2009-06-06 18:30:03', '2009-06-06 18:34:48', '1' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('33', '1', '', '', '0', '2/3' , '3' , '3-2' , '' , '0', '0', '', '2009-06-06 18:32:30', '0000-00-00 00:00:00', '4' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('34', '1', '', '', '0', '3/5' , '5' , '7-3' , '' , '0', '0', '', '2009-06-07 00:23:42', '2009-06-07 18:36:26', '3' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('35', '1', '', '', '0', '5/6' , '2' , '1-2,2-3' , '' , '0', '0', '', '2009-06-07 01:02:45', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('36', '1', '', '', '4', '5/6' , '2' , '1-2,2-3' , '' , '0', '0', '', '2009-06-07 01:05:30', '2009-06-07 18:48:45', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('37', '1', '', '', '0', '5/3' , '5' , '1-2,2-3,6-2' , '' , '0', '0', '', '2009-06-07 01:08:27', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('38', '1', '', '', '0', '5/3' , '5' , '1-2,2-3,6-2' , '' , '0', '0', '', '2009-06-07 01:15:58', '0000-00-00 00:00:00', '4' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('39', '1', '', '', '0', '1' , '2' , '1-1,2-2,7-6' , '' , '0', '0', '', '2009-06-07 16:02:30', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('40', '1', '', '', '0', '2/1' , '1' , '7-1,9-1' , '' , '0', '0', '', '2009-06-07 16:40:46', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('41', '1', '', '', '4', '2' , '1' , '7-1,9-1' , '1,3.95,Teds Dish' , '0', '0', '', '2009-06-07 16:44:44', '2009-06-08 01:55:20', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('42', '1', '', '', '0', '1' , '2' , '3-1,6-1,11-1,22-1' , '' , '0', '0', '', '2009-06-07 16:48:07', '0000-00-00 00:00:00', '0' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('43', '1', '', '', '3', '1/2' , '5' , '9-1,13-1,16-1' , '' , '0', '0', '', '2009-06-07 17:07:17', '2009-06-08 16:03:37', '1' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('44', '1', '', '', '3', '2/3' , '11' , '5-3,11-1' , '' , '0', '2', '', '2009-04-01 19:22:28', '2009-06-07 20:51:17', '1' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('45', '1', '', '', '3', '1/5' , '11' , '14-1,15-2,17-1,18-2,19-1' , '' , '0', '5', '', '2009-06-07 19:47:00', '2009-06-08 01:11:19', '3' , ' ' ) INSERT INTO order (id, type, name, phone, waiter, tableno, guestno, orders, specialorder, coupon, coupon1, couponcat, time, time1, paid, additional) VALUES ('46', '1', '', '', '5', '1/3' , '7' , '17-1,18-3' , '2,5.40,Chef' , '0', '5', '', '2009-06-08 13:22:01', '2009-06-08 16:12:12', '4' , ' ' ) the error comes out: Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 Warning: sqlite_query() [function.sqlite-query]: near "order": syntax error in /var/www/restaurant/backup/test.php on line 11 But the syntax error doesn't seem to reveal much, Thanks, Ted Quote Link to comment https://forums.phpfreaks.com/topic/267863-sql-insertion-error/ Share on other sites More sharing options...
Jessica Posted August 31, 2012 Share Posted August 31, 2012 order is a reserved word. You either need to surround your table name in backticks `order` or (best option) pick a different name. Even orders would work. Quote Link to comment https://forums.phpfreaks.com/topic/267863-sql-insertion-error/#findComment-1374325 Share on other sites More sharing options...
ted_chou12 Posted August 31, 2012 Author Share Posted August 31, 2012 thanks! I didn't realize it does conflict with the order by command in this case. I wish I had picked some other word. Quote Link to comment https://forums.phpfreaks.com/topic/267863-sql-insertion-error/#findComment-1374359 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.