我正在尝试使用以下语法来更新我的数据库,但它不起作用,当我使用Instant SQL Formatter时,它说:
Syntax Error: =(1,76) expected token:(
这是MySQL代码:(由PHP运行)
UPDATE parts SET name='How do you use it?', part_order='0', top='334', left='44', width='150', height='26', value='', script='on mouseup\nanswer \"To use jsCard, all you need is an account! From there you can create stacks, then cards, then you can start building on those cards. To build on cards, simply double click on an object in the tools palette, assign a name to your new object, then, if it is a button, add a script to make it do wonderful things!\"\nend mouseup', visible='1', enabled='1', style='5', family='0', locktext='0', hilite='0', autohililte='1' WHERE stacks_id=1 AND cards_id=1 AND part_id=19
有谁能告诉我我的语法有什么问题?
答案 0 :(得分:2)
这可能是因为您的INSERT
语句包含以下行left
是字符串函数,所以它期待()
围绕它
left='44'
你应该使用像
这样的背景来逃避它UPDATE parts SET
name='How do you use it?',
part_order='0',
top='334',
`left`='44', <-- Here
width='150',
height='26',
value='',
script='on mouseup\nanswer \"To use jsCard, all you need ...',
visible='1',
enabled='1',
style='5',
family='0',
locktext='0',
hilite='0',
autohililte='1'
WHERE stacks_id=1
AND cards_id=1
AND part_id=19
答案 1 :(得分:2)
left
是一个MySQL关键字。如果要将其用作标识符(例如列名),请将其包装在反引号中。为清晰起见,最好将所有标识符包装在反引号中。
UPDATE parts SET
name='How do you use it?',
part_order='0',
top='334',
`left`='44',
width='150',
height='26',
value='',
script='on mouseup\nanswer \"To use jsCard, all you need is an account! From there you can create stacks, then cards, then you can start building on those cards. To build on cards, simply double click on an object in the tools palette, assign a name to your new object, then, if it is a button, add a script to make it do wonderful things!\"\nend mouseup',
visible='1',
enabled='1',
style='5',
family='0',
locktext='0',
hilite='0',
autohililte='1'
WHERE stacks_id=1 AND cards_id=1 AND part_id=19