0

I'm trying to use order by, I want to use this select:

Select * from tarea where cod_tarea = $row order by estado;

$tarea_data = $database->select("tarea","*",['cod_tarea' => $row], ["ORDER" => "estado"]);
$tarea_data = $database->select("tarea","*",['cod_tarea' => $row, "ORDER" => "estado"]);

But doesn't work

Zano
  • 15
  • 6

1 Answers1

0

According to an example in the docs, you can do it like this:

$tarea_data = $database->select(
    "tarea",
    "*",
    [
        'cod_tarea' => $row, 
        "ORDER" => [
            "estado" => "ASC",
        ]        
    ]
);

Note that you should use DESC for descending in case you want a descending order of items. I am assuming you meant ascending here.

ArSeN
  • 5,133
  • 3
  • 19
  • 26
  • Not working :/ the estado is a ENUM... maybe thats why? – Zano Mar 11 '21 at 06:43
  • Should still be working. Can you please explain in more detail in your question what you are expecting and what is happening instead? – ArSeN Mar 11 '21 at 11:47