我试图制作这样的存储过程:
DELIMITER $$
DROP PROCEDURE IF EXISTS get_userStatUser $$
CREATE PROCEDURE get_UserStatUser
(
IN userId INT,
OUT Played INT,
OUT Win INT,
OUT Points INT
)
BEGIN
SELECT played, win, points
INTO Played, Win, Points
FROM nf_users
WHERE id = userId;
END $$
DELIMITER ;
然后我尝试像这样从中获取数据:
$sql = mysqli_query($connect,"CALL get_userStatUser()") or die("Query fail: " . mysqli_error());
$row = mysqli_fetch_array($sql);
$played = $row['Played'];
$win = $row['Win'];
$points = $row['Points'];
但有些不对劲。我是存储过程的新手,看不到哪里出错了?我得到“查询失败:”,但没有任何错误?
任何帮助都非常感谢,并在此先感谢:-)