arashaga
asked on
mysql Stored Procedure with Output parameter
I have the following stored procedure that puts a website url in a table with its description and so forth and returns the last inserted id . I was wondering if someone could give me an example with php PDO so that I can pass the parameters to it and also capture the output parameter.
Thanks
Thanks
DELIMITER $$
create PROCEDURE add_website(IN website varchar(30),IN active Bool,
IN description varchar(150),OUT lastInsertedId INT)
begin
insert into website (website_url,date_created,active,description)
values(website,NOW(),active,description);
select LAST_INSERT_ID() into lastInsertedId;
END $$
did you tried the example given in the links, is the example for your question.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
arashaga: I'm trying to do the very same thing. The sample code that you have pasted here doesn't seem to be complete: for example, where are you binding the output parameter? Would you be able to reply ASAP please?
http://www.php.net/manual/pt_BR/pdo.lastinsertid.php
http://php.oregonstate.edu/manual/en/pdo.lastinsertid.php
HTH,
~PG