tags:

views:

36

answers:

3

sorry, i dont like to ask such instance specific questions but this is driving me MENTAL!

there's gotta be something obvious i'm missing:

table:

|ven_name|varchar(150)|No|
|ven_sd|varchar(90)|Yes|NULL
|ven_details|varchar(3000)|Yes|NULL
|ven_tel|varchar(30)|Yes|NULL
|ven_email|varchar(50)|Yes|NULL
|ven_address|varchar(300)|Yes|NULL
|lat|decimal(9,6)|Yes|NULL
|long|decimal(9,6)|Yes|NULL
|pub|tinyint(4)|Yes|NULL
|bar|tinyint(4)|Yes|NULL
|club|tinyint(4)|Yes|NULL
|img_added|tinyint(4)|Yes|NULL

query:

INSERT INTO ven
            (img_added,
             ven_name,
             ven_sd,
             ven_tel,
             ven_email,
             ven_address,
             lat,
             long,
             pub,
             ven_details)
VALUES     (1,
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            100,
            156,
            1,
            'aaa') 

error:

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 'long, pub, ven_details) VALUES(1, 'aaa', 'aaa', '0117 9246449', 'aaa', 'aaa', 10' at line 1
+4  A: 

'long' is a reserved word in MySQL. Escape it using backticks:

http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html

Jakob Kruse
A: 

It's the long, it's a reserved word in mySQL. Funnily enough, the syntax highlighting seems to catch it :)

Rename the column or use backticks:

`lat`,
`long`,
`pub`,

Reference: mySQL reserved words

Pekka
A: 

LONG is a reserved mysql word.

Change it for LNG or you could do this:

INSERT INTO ven
            (img_added,
             ven_name,
             ven_sd,
             ven_tel,
             ven_email,
             ven_address,
             lat,
             `long`,
             pub,
             ven_details)
VALUES     (1,
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            'aaa',
            100,
            156,
            1,
            'aaa') 
Shuriken