PDO with update
PDO with update

Hi all ! I m working with datatables FixedHeader. In pdo statement is used Order by. Sample:
$date_reserv_tmp = '2020-04-23';
$room = "Room01";
$stmt = $pdo->prepare("Select Id, name, room, date_reserv, country FROM table where room =:room and left(date_reserv,10) = :$date_reserv_tmp Order by :country");
$stmt->bindValue(':room', $room);
$stmt->bindValue(':date_reserv', $date_reserv_tmp);
$stmt->bindValue(':country', $country);
$stmt->execute();
After execute rows are not order as I want but they are order by Id.
What is wrong ? Thank you !
Replies
Your advice is the same problem..When I dont use funcionality with datatables order by is good. But when I use funcionality with datatables then order by is wrong; selected records are order by Id again.
You must order your records on the client using data tables. The order by in your SQL is redundant.