PHP语法错误将数据添加到MySQL数据库

trying to add data to mySQL db.

I get this 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(time, date, location, weather, team_id) VALUES('t', 't', 't','t','2')'

this is the PHP code snippet:

$sql = "insert into MATCH(time, date, location, weather, team_id) VALUES('$time', '$date', '$location','$weather','$team_id')";

I cant see any syntax errors

MATCH is a reserved for a function used in fulltext search:

http://dev.mysql.com/doc/refman/5.5/en/fulltext-search.html

That's not a php syntax error. It's a Mysql syntax error. I suggest changing the table's name.

Try

$sql = "INSERT INTO `MATCH` (`time`, `date`, `location`, `weather`, `team_id`) VALUES ('".$time."', '".$date."', '".$location."','".$weather."','".$team_id."')";

Using the backtick character ` you can distinguish names you gave to your table or columns from reserved words of the MySQL language. Leaving them out might seem more compfortable at first, but can be a pain later.

E.g. one should know that mysql syntax is not case sensitive. So even if you write match you will get this problem. A list of the reserved words can be found at the link Mark gave you in his comment.

You might also want to read up on MySQL Syntax in general: