Syntax of Mysql

Asked

Viewed 42 times

0

I can’t see the error:

UPDATE clientes SET 
txtEndereco=\"Rua Xingú, 823\", 
txtBairro=\"Val Paraíso\", 
txtCEP=\"09060-050\", 
txtUF=\"35\",
txtCidade=\"14933\",
regiaos=\"\",
Obs=\"Princesa fada\") 
WHERE idCliente = \"2\

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 ' "Rua Xingãº, 823 ", txtBairro= "Val Paraã-so ", txtCEP= "09060-050 ", txtUF= "3' at line 1

  • 1

    To specify values, always use single quotes!

  • 1

    There was one "left) before WHERE too... thanks man!

1 answer

3


You have to use them by simple quotation marks and you don’t necessarily need to escape them, unless the word has in its string the character of the quotation marks.

UPDATE clientes SET 
txtEndereco = 'Rua Xingú, 823', 
txtBairro = 'Val Paraí­so', 
txtCEP = '09060-050', 
txtUF = 35,
txtCidade = '14933',
regiaos = '',
Obs = 'Princesa fada'
WHERE idCliente = 2

Browser other questions tagged

You are not signed in. Login or sign up in order to post.