My code is:
<?php
$pdo = new PDO("mysql:host=example;dbname=test;","test","test");
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$st = $pdo->prepare("select * from account where username =? limit ?");
$st->execute(array('buding',2));
$res = $st->fetchAll();
var_dump($res);
?>
When I use it on PHP 5.1.6, I see the sql through Wireshark sent to mysql is:
select * from account where username ='23' limit '2'
But on PHP 5.3, the sql is:
select * from account where username =? limit ?
(what I want)
How can I use the true PDO prepare? Is it a PHP's bug, or I use it the wrong way?
My MySQL version is 5.0.7.