I’ve been working on a stored procedure that runs a select statement in a loop.
When viewing results through mysqli or phpmyadmin, I only receive one row. What do I need to do to return multiple rows?
Here’s a really simple example that illustrates my problem….
DROP PROCEDURE IF EXISTS simple //
CREATE PROCEDURE simple()
BEGIN
DECLARE c INT(10);
SET c = 1;
REPEAT
SELECT c;
SET c = c + 1;
UNTIL c >= 10 END REPEAT;
END //
I think the best way to handle this would actually be to store your output into a temporary table, and then do a final select at the end of the while loop.