I would like to ask about the pdo prepare statement, which was edited by Cainiao at 2013-03-0816: 13: 15 after being edited by rainxies. this method is similar to querying multiple SQL statements at the same time, how to obtain the result set using prepare? $ Dbh & nbsp ;=& nbsp; new & nbs ask about pdo prepare usage
At last, this post was edited by rainxies at 16:13:15 on,
Similar to this method, you can query multiple SQL statements at the same time. how can you obtain the result set using prepare?
$dbh = new PDO($dbConnString, $dbInfo['username'], $dbInfo['password']);
$query = $dbh->query($queryString);
$i = 0;
foreach ($query as $query2) {
$queryReturn[$i] = $query2;
$i++;
}
------ Solution --------------------
This post was last edited by xuzuning at 09:05:47. if your SQL command is like #1, sorry!
Select FOUND_ROWS () will not be sent to mysql for execution because it violates the security conventions for executing only one command at a time.
You can write your two commands as a stored procedure.
delimiter //
CREATE PROCEDURE `test`()
begin
select SQL_CALC_FOUND_ROWS * from table limit 1,10;
select FOUND_ROWS();
end;
//
Then execute
$queryString = 'call test();';
$query = $dbh->query($queryString);
do {
$rows = $query->fetchAll();
print_r($rows);
}while($query->nextRowset());