简体   繁体   English

多个查询/结果(PDO / MySQL)

[英]Multiple queries/results (PDO/MySQL)

I have a form where people can submit any and all kinds of MySQL queries and as I am now moving from MySQLi to PDO I am wondering if there is any way to deal with multiple query results using PDO. 我有一个表格,人们可以提交任何种类的MySQL查询,而当我现在从MySQLi迁移到PDO时,我想知道是否有任何方法可以使用PDO处理多个查询结果。 So let's say that a user submits the following to the PDO query method via an HTML form: 假设用户通过HTML表单将以下内容提交给PDO查询方法:

SELECT * FROM `organisation`.`employee`;
SELECT * FROM `organisation`.`salary`;

Is there a way to deal with both results? 有没有办法处理这两种结果?

Split the entry string by the delimiter of ";", cycle through the released array. 用分隔符“;”分隔输入字符串,循环浏览释放的数组。

That'd be one way at least. 那至少是一种方法。

Here's an alternative . 这是另一种选择

Here's a link to the PDOStatement::nextRowset page . 这是指向PDOStatement :: nextRowset页面链接 Read the example. 阅读示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM