多个查询/结果(PDO/MySQL) [英] Multiple queries/results (PDO/MySQL)

查看:63
本文介绍了多个查询/结果(PDO/MySQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格,人们可以提交任何种类的MySQL查询,而当我现在从MySQLi迁移到PDO时,我想知道是否有任何方法可以使用PDO处理多个查询结果.因此,假设用户通过HTML表单向PDO查询方法提交了以下内容:

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. So let's say that a user submits the following to the PDO query method via an HTML form:

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.

那至少是一种方法.

这是替代方法.

这是链接到PDOStatement :: nextRowset页面.阅读示例.

这篇关于多个查询/结果(PDO/MySQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆