我在mysql中创建了以下存储过程...
DELIMITER //
CREATE PROCEDURE GetMember(IN in_memberID int)
BEGIN
SELECT *
FROM Members
WHERE MemberID = in_memberID;
END//
$result = mysql_query("CALL GetMember(".$memberID.")") or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
echo $row['Name'] . "</br>";
}
但是当我从php调用它时会返回Members表中的所有记录,我做错了什么?
编辑: 当我尝试在phpmyadmin中调用查询时出现此错误
CALL GetMember(1);
#1312 - PROCEDURE myDb.GetMember can't return a result set in the given context
答案 0 :(得分:0)
什么版本的PHP?
PHP 5.2.3和PHP 5.2.4有一个程序错误: https://bugs.php.net/bug.php?id=42548
答案 1 :(得分:0)
use Database_Name;
DELIMETER $$
DROP PROCEDURE IF EXISTS Proc$$
CREATE PROCEDURE Proc()
BEGIN
DECLARE x INT;
SET x = 1;
WHILE x <= 110000 DO
INSERT INTO Table_Name (word, mean) VALUES ('a', 'a mean');
SET x = x + 1;
END WHILE;
END$$
DELIMITER ;