开发者

mysql&php - Cannot execute Stored Procedure twice

开发者 https://www.devze.com 2023-03-10 20:46 出处:网络
CREATE PROCEDURE GetHandTypes() BEGIN SELECT * FROM Codemst WHERE code LIKE \"HT%\" A开发者_StackOverflow社区ND dep > 0;
CREATE PROCEDURE GetHandTypes()
BEGIN
    SELECT * FROM Codemst WHERE code LIKE "HT%" A开发者_StackOverflow社区ND dep > 0;
END$$

$result = mysql("CALL GetHandTypes()");
$row = mysql_fetch_assoc($result);
mysql_free_result($result);

It's work well. but When I try twice, It returns nothing.

$result = mysql_query("CALL GetHandTypes()");
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
print_r($row);

$result = mysql_query("CALL GetHandTypes()");
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
print_r($row); //null


You may need to close the SQL connection after the first call, try using mysqli_query instead. See: (Comment: rogier 10-Apr-2008 01:55 at http://php.net/manual/en/function.mysql-query.php )

0

精彩评论

暂无评论...
验证码 换一张
取 消