rp_joe Posted November 10, 2008 Share Posted November 10, 2008 I am getting an error: SQL error: Query: insert into Inven ( h_num, upc, cs_upc, descript) values ( 5067 , 34998, 05000042634, FANCY FST SLC BEEF ) 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 'FST SLC BEEF )' at line 4 Here is the code : insert into Inven ( h_num, upc, cs_upc, descript) values ( 5067 , 34998, " . $real_upc_cs .", ". $descript ." ) ; If I take descript out it runs fine. I thought its must be defined wrong in the table, so I changed it from a var char to a char. Same result. Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/ Share on other sites More sharing options...
F1Fan Posted November 10, 2008 Share Posted November 10, 2008 You need quotes around text. Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686846 Share on other sites More sharing options...
flyhoney Posted November 10, 2008 Share Posted November 10, 2008 I believe you need quotes around FANCY FST SLC BEEF insert into Inven ( h_num, upc, cs_upc, descript) values ( 5067 , 34998, 05000042634, 'FANCY FST SLC BEEF' ) Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686847 Share on other sites More sharing options...
rp_joe Posted November 10, 2008 Author Share Posted November 10, 2008 I have quoutes around the varible, Is that enough? Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686859 Share on other sites More sharing options...
premiso Posted November 10, 2008 Share Posted November 10, 2008 Nope. Insert into Inven ( h_num, upc, cs_upc, descript) values ( 5067 , 34998, " . $real_upc_cs .", '". $descript ."' ) ; You need single quotes around all text being entered into a SQL database. Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686864 Share on other sites More sharing options...
kenrbnsn Posted November 10, 2008 Share Posted November 10, 2008 Please post your code between tags. This will make it much easier to read. Ken Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686865 Share on other sites More sharing options...
rp_joe Posted November 10, 2008 Author Share Posted November 10, 2008 Amazing !!! Thank you. Link to comment https://forums.phpfreaks.com/topic/132158-snytax-problem/#findComment-686868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.