0

I'm getting a syntax error with this block of code, and I have no idea why. Here is the specific error itself:

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 ORDER BY id DESC' at line 1

Here is the PHP code block:

$sql = "SELECT * FROM match ORDER BY id DESC";
$res = mysqli_query($dbCon, $sql);
Dharman
  • 26,923
  • 21
  • 73
  • 125

1 Answers1

3

MATCH is a reserved keyword in mysql: https://dev.mysql.com/doc/refman/5.0/en/keywords.html

To make your code working change your query to:

$sql = "SELECT * FROM `match` ORDER BY id DESC";
Daan
  • 11,690
  • 6
  • 30
  • 49