I have created few stored procedures in MySql, using the commands
CREATE PROCEDURE sample()
BEGIN
SELECT * FROM members;
END //
But when i want to cal a stored procedure in my phpMyAdmin or using php i am not getting the result.Commands i used
CALL sample;
and also
CALL sample();
When i use he above query no output is shown instead page is redirected to phpMyAdmin home page .
Do i need to make any changes in phpMyAdmin???
Your stored procedure is most probably not being created.
You must include the
DELIMITERcommand to tell MySQL to ignore the;in your command:That tells MySQL to use a different delimiter (
//in this case) and restore it (the standard;delimiter) at the end of the query.Then, check your procedure exists with
SHOW PROCEDURE STATUS.As far as I know, you shouldn’t need the brackets
()to call a procedure that doesn’t require any arguments.Hope that helps.