How to create a stored procedure in mysql

advertisements

I have created the following stored procedure in 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>";
}

But when I call it from php it returns all records in the Members table, what am I doing wrong?

EDIT: When I try to call the query within phpmyadmin I get this error

CALL GetMember(1);

#1312 - PROCEDURE myDb.GetMember can't return a result set in the given context


what version of PHP?

PHP 5.2.3 and PHP 5.2.4 have a bug with procedures: https://bugs.php.net/bug.php?id=42548