我有PHP代码从数据库调用存储过程。
<?php
include("DataBase.php");
$sql=$mysqli_query("CALL sp()");
if( $sql === FALSE ) {
trigger_error('Query failed returning error: '. $mysqli_error(),E_USER_ERROR);
} else {
while($row=$mysqli_fetch_array($sql))
{
echo $row['id'].'--'.$row['item'].'';
}
}
?>
DB Conection;
<?php
$mysqli_hostname = "localhost";
$mysqli_user = "root";
$mysqli_password = "";
$mysqli_database = "liveedit";
$bd = $mysqli_connect($mysqli_hostname, $mysqli_user, $mysqli_password)
or die("Opps some thing went wrong");
$mysqli_select_db($mysqli_database, $bd) or die("Opps some thing went wrong");
?>
代码返回此错误:
Fatal error: Function name must be a string in C:\xampp\htdocs\ambot\database.php on line 6
代码有什么问题?我尝试修复此问题,但在我的代码中使用存储过程修复此问题会增加难度。