This question already has an answer here:
I am trying to use the following syntax to update my database, but it is not working, and when I use Instant SQL Formatter, it says:
Syntax Error: =(1,76) expected token:(
Here is the MySQL code: (that is being run by 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
answer \"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!\"
end 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
Can anyone tell me what is wrong with my syntax?
</div>
That's probably because your INSERT
statement contain the below line where left
is string function and so it's expecting ()
around it
left='44'
You should escape it using backtique like
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
answer \"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
left
is a MySQL keyword. If you want to use it as an identifier (such as a column name) wrap it in backticks. It's a good idea to wrap all your identifiers in backticks anyway for clarity.
UPDATE parts SET
name='How do you use it?',
part_order='0',
top='334',
`left`='44',
width='150',
height='26',
value='',
script='on mouseup
answer \"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!\"
end 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