Question

I've got a little problem with a sql request:

my $sql resquest ( result of echo $sql ):

INSERT INTO match (id, id_match, login, real_login, reponse, date) VALUES (NULL, '11', 'CaptainRida', 'rbikitar', 'oui', '2014-06-07')

and the error

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 'match (id, id_match, login, real_login, reponse, date) VALUES (NULL, '11', 'Capt' at line 1

the sql request is truncated at 'login'. always 4 characters and BAM truncated.

can anyone help me, I have THE SAME SQL RESQUEST with another table ( exactly the same except rencontre instead of match and id_rencontre instead of id_match)

the "rencontre" request works great and the "match" request is truncated in the error.

Was it helpful?

Solution

MATCH is a MySQL reserved word.

Enclose it in backticks:

insert into `match` (id, id_match, ...

Or, consider changing the name of the table to not use a reserved word (recommended).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top