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
  • 30,962
  • 25
  • 85
  • 135

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
  • 12,099
  • 6
  • 34
  • 51