I want to sp parameter via php mysql I send in. This is my code
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);
}
This is my connection
<?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() );
}
?>
And this is my sp
BEGIN
SELECT * FROM `students` WHERE `id`= id;
END
And the variable $ id is received by session
$id = $_SESSION['id'];
But when I run the project I get the following error is
Commands out of sync; you can't run this command now
thank you