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 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]}') "; Link to comment https://forums.phpfreaks.com/topic/153009-insert-query-issue/#findComment-803620 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.