Jump to content

insert query issue


never_rain

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.