-4

I'd like to order the following query by id desc (it's a column in the "check_todo"-table). Can anybody help me? :)

$todo_query = mysqli_query($db, "SELECT * FROM check_todo WHERE id=".$row2->todo." ORDER by id DESC");
while($row3 = mysqli_fetch_object($todo_query))
    {

it's not duplicate and it is not because of the reserved word. It doesn't work with "id" oder "placeholder" (both columns in check_todo) either...

David
  • 1
  • 1

1 Answers1

0

TYPE is a reserved keyword in MySQL.
Add backticks around it:

$todo_query = mysqli_query($db, "SELECT * FROM check_todo WHERE id=".$row2->todo . 
      " ORDER by `type` ASC");
Jocelyn
  • 11,209
  • 10
  • 43
  • 60