我已经安装了 XAMPP,并尝试使用 PHP 查询我的数据库,尽管我不断收到相同的错误。
<?php
$servername = "localhost";
$username = "root";
$password = "secret";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Perform queries
$result = mysqli_query($conn,
"use edgeserver; call ShowAll") or die("Query fail: " . mysqli_error());
//loop the result set
while ($row = mysqli_fetch_array($result)){
echo $row[0] . " - " . + $row[1];
}
$conn->close();
?>
但是这给我带来了以下错误:
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\amit\ShowAll.php on line 16
Query fail:
最佳答案
Mysql_error 需要传递数据库连接。请尝试以下操作:
mysqli_error($conn);
关于php - 通过PHP调用MySQL存储过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30297896/