Ask Cainiao for instructions on pdo's prepare usage,
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++;}
Reply to discussion (solution)
I mainly want to use
select SQL_CALC_FOUND_ROWS * from table limit 1,10;select FOUND_ROWS();
One-time query for pagination with parameters
No one else ......
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());
Thanks, xuzuning. if you do not need stored procedures
begin select SQL_CALC_FOUND_ROWS * from table limit 1,10; select FOUND_ROWS(); end;
What about this?
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.
Can you write your two commands as the stored procedure SQL code? 1234567 delimiter // CR ......
Can you try it?
Php does not allow the execution of more than one SQL command at a time. it is completely out of the consideration of preventing SQL attacks.
If you use mysqli extension, you can use mysqli_multi_query to execute multiple SQL commands at a time. Of course, you are responsible for security.
Thank you !!!
Can you help me see this problem? Thank you !!!
Http://bbs.csdn.net/topics/390388184
Can you try it?
Php does not allow the execution of more than one SQL command at a time. it is completely out of the consideration of preventing SQL attacks.
If you use mysqli extension, you can use mysqli_multi_query to execute multiple SQL commands at a time. Of course, you are responsible for security.
Can you try it?
Php does not allow the execution of more than one SQL command at a time. it is completely out of the consideration of preventing SQL attacks.
If you use mysqli extension, you can use mysqli_multi_query to execute multiple SQL commands at a time. Of course, you are responsible for security.