Jump to content

Snytax problem?


rp_joe

Recommended Posts

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

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

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.