Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: open
I have a simple MySQL query as below that I am re-using from another page with different values:
$qry = "INSERT INTO match(matchdate,matchtime,opposition) VALUES('$matchdate','$matchtime','$opposition')";
$result = @mysql_query($qry);
However this returns the error message:
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(matchdate,matchtime,opposition) VALUES('19/01/2009','19:00','Stoke')' at line 1
There are only 2 tables in the DB at present, if I change the table name and fields to the other one then it works fine.
Have checked all the connection settings / fieldnames and everything else I can think of, is it possible that a table could just simply not work?
But a fix, should you choose to go with it, is to backtick the table name. This should do it.
$qry = "INSERT INTO `match` (matchdate,matchtime,opposition) VALUES('$matchdate','$matchtime','$opposition')";