never_rain Posted April 7, 2009 Share Posted April 7, 2009 Hi, I am facing a bit of problem. Here is the query. $query1 ="INSERT INTO tbl_form (orderid, fieldName, fieldValue) VALUES ('$p', '$res[size_name]', '$formItems["val1".$p]') "; and I get the following error 1064 - 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 'Name, fieldValue=Faisal Niaz' at line 1 insert into tbl_form set orderid = 1, fieldName=Full Name, fieldValue=Faisal Niaz; I was able to display the values but cant insert it. here is wot I used to display. echo $res['size_name'].": ".$formItems["val1".$p]."<br>"; Problem is with this array item. $formItems["val1".$p] when I display it gives correct value but when I use it in the insert query, it gives the error. I assume there is some problem with Inverted Commas. I have been trying different options but couldnt resolve it. Please help.. Thanks Faisal Quote Link to comment https://forums.phpfreaks.com/topic/153009-insert-query-issue/ Share on other sites More sharing options...
Maq Posted April 7, 2009 Share Posted April 7, 2009 Try: $query1 ="INSERT INTO tbl_form (orderid, fieldName, fieldValue) VALUES ('$p', '$res[size_name]', '{$formItems['val1' . $p]}') "; Quote Link to comment https://forums.phpfreaks.com/topic/153009-insert-query-issue/#findComment-803620 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.