小白教程
所有教程
关于
Search
172.69.58.33
172.69.58.33
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func mysqli multi query”的源代码
本页内容
上一节:
Func_mysqli_more_results
下一节:
Func_mysqli_next_result
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:mysqli_multi_query()}}[[Category:PHP MySQLi 函数参考手册|43]] = PHP mysqli_multi_query() 函数 = [[:Category:PHP MySQLi 函数参考手册]] 执行多个针对数据库的查询: <sample title="" desc="" lang="php" hererun="1"> <?php $con=mysqli_connect("localhost","my_user","my_password","my_db"); // 检测链接 if (mysqli_connect_errno($con)) { echo "连接到 MySQL 失败: " . mysqli_connect_error(); } $sql = "SELECT Lastname FROM Persons ORDER BY LastName;"; $sql .= "SELECT Country FROM Customers"; // 执行多个 SQL 语句 if (mysqli_multi_query($con,$sql)) { do { // 存储第一个结果集 if ($result=mysqli_store_result($con)) { while ($row=mysqli_fetch_row($result)) { printf("%sn",$row[0]); } mysqli_free_result($result); } } while (mysqli_next_result($con)); } mysqli_close($con); ?> </sample> == 定义和用法 == mysqli_multi_query() 函数执行一个或多个针对数据库的查询。多个查询用分号进行分隔。 == 语法 == <pre> mysqli_multi_query(connection,query); </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | connection | 必需。规定要使用的 MySQL 连接。 |- | query | 必需。规定一个或多个查询,用分号进行分隔。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | 如果第一个查询失败则返回 FALSE。 |- | PHP 版本: | 5+ |} [[:Category:PHP MySQLi 函数参考手册]]
返回至“
Func mysqli multi query
”。
上一节:
Func_mysqli_more_results
下一节:
Func_mysqli_next_result