MySQL Error #1064 - Tiene un error en su sintaxis SQL; [cerrado]
Frecuentes
Visto 2,354 veces
0
A little help please! I really don't know what's going on here already. I have read a lot about this but there just seems to be nothing I can find wrong with this query:
INSERT INTO clients (water_bill_doc_url) VALUES ('client-uploads/01/water_bill.png') WHERE `client_id` = '74'
but still I keep getting this error:
#1064 - 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 'WHERE `client_id` = '74'' at line 1
if it helps, this clients
table is InnoDB.
2 Respuestas
3
INSERT INTO table (fields) VALUES (values) WHERE condition
Wait, what? Since when did INSERT
permitir WHERE
cláusulas?
You either want to do an UPDATE
or put that client_id
in the fields to insert.
Respondido 25 ago 12, 03:08
2
An INSERT
declaración no tiene WHERE
clause, as it is for creating Un nuevo rows. We can assume you intended an UPDATE
statement, since you wish to match an existing row:
UPDATE
clients
SET water_bill_doc_url = 'client-uploads/01/water_bill.png'
WHERE `client_id` = '74'
Lea las MySQL UPDATE
referencia de sintaxis for full details on the syntax.
Respondido 25 ago 12, 03:08
thank you Mike! I really did not know what I was doing with the INSERT
statement there.. geez! - user1611778
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php mysql mysql-error-1064 or haz tu propia pregunta.
wow! lol! geez! never thought about that! sorry guys... mysql noob here.. it's just that I have never read that from anywhere.. my bad. - user1611778