Chris White wrote:
On Monday 27 November 2006 07:59, Filipe Freitas wrote:
Hi,
This is not a mysql thing but maybe you can help me.
I want to call a stored procedure from PHP, so I tried it like normal
querys: mysql_query("CALL mySP();"); with no success.
thx
No success how? Generally with stored procedures and returning values, you
use a session variable and utilize it as OUT like so:
DROP PROCEDURE IF EXISTS CURVAL $
CREATE PROCEDURE CURVAL (OUT current INT)
BEGIN
SELECT value INTO current FROM sequence;
END $
DELIMITER ;
so when I go to call curval:
CALL CURVAL(@cur)
and the value can be received by:
SELECT @cur;
My stored procedure is the following:
CREATE PROCEDURE `getListaDeNewsflashes`(in quantidade smallint)
COMMENT 'Devolve uma tabela com um nĂºmero limite de newsflashes'
begin
PREPARE statement FROM "SELECT * FROM newsflashes ORDER BY RAND() LIMIT ?";
SET @limit=quantidade;
EXECUTE statement USING @limit;
end
it works when I execute it on mysql monitor: call
getListaDeNewsflashes(10);
in php it doesn't. I think I need the out session variable like you
said. But how? I will need a variable for every column?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]