我想通过我发送的php mysql sp参数。 这是我的代码
function sendSpId()
{
global $id;
global $connection;
$sql = "CALL `sp_st_SelectUserAll`($id)";
$result = mysqli_query($connection, $sql);
if ($result === FALSE) {
die(mysqli_error($connection)); // TODO: better error handling
}
//loop the result set
return mysqli_fetch_array($result);
}
这是我的连接
<?php
$serverName = "localhost";
$userName = "root";
$pass = "";
$dbName = "univercity";
$connection = mysqli_connect($serverName, $userName, $pass, $dbName);
mysqli_set_charset($connection, "utf8");
if ( !$connection ) {
die( 'connect error: '.mysqli_connect_error() );
}
?>
这是我的sp
BEGIN
SELECT * FROM `students` WHERE `id`= id;
END
变量$ id由会话
接收$id = $_SESSION['id'];
但是当我运行项目时,我得到以下错误
Commands out of sync; you can't run this command now
谢谢