What's wrong with my using pdo this way?
Posted
by user198729
on Stack Overflow
See other posts from Stack Overflow
or by user198729
Published on 2010-04-21T14:04:31Z
Indexed on
2010/04/21
14:13 UTC
Read the original article
Hit count: 164
$sql = "SELECT * FROM table ORDER BY :sort :dir LIMIT :start, :results";
$stmt = $dbh->prepare($sql);
$stmt->execute(array(
'sort' => $_GET['sort'],
'dir' => $_GET['dir'],
'start' => $_GET['start'],
'results' => $_GET['results'],
)
);
I tried to use prepare
to do the job,but $stmt->fetchAll(PDO::FETCH_ASSOC);
returns nothing.
© Stack Overflow or respective owner