mysql&php - Cannot execute Stored Procedure twice
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 )
精彩评论