binding SQL: [39] select * from tasks order by :order asc
Sent SQL: [40] select * from tasks order by 'email' asc
here is code
<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', 'root', '');
$sql = 'select * from tasks order by :order asc';
$sth = $dbh->prepare($sql);
$sth->execute([':order' => 'email']);
$sth->debugDumpParams();
print_r($sth->fetchAll());
https://stackoverflow.com/questions/2907687/why-doesnt-binding-parameter-in-order-by-clause-order-the-results
Обсуждают сегодня