Page 1 of 1

Return reseultset from stored procedure???

Posted: Wed Jul 15, 2009 1:59 pm
by alex.barylski
I have a stored procedure it works great, but when I run it in phpMyAdmin or PHP I do not get any results.

I have added an outgoing parameter BUT it doesn't appear that resultsets can be returned from a procedure or function as arrays are not supported. I asked a fellow co-worker and he suggested I look into creating a temp table to dump results into then pull from that temp table?

I"m Googling but have not been able to find anything complete, can someone explain the steps and/or show actual SQL and PHP code on how this might be done -- probably the SQL_SP code more than anything, thanks :)

Cheers,
Alex

Re: Return reseultset from stored procedure???

Posted: Wed Jul 15, 2009 7:22 pm
by Weirdan
In MySQL stored procedure can generate a resultset (I know it's not the case for some other DBMSes).

Here's something to get you on the right track: http://209.85.229.132/search?q=cache:rk ... en&ct=clnk

Re: Return reseultset from stored procedure???

Posted: Thu Jul 16, 2009 9:34 am
by alex.barylski
Oops...forgot about this post. Sorry man.

Anyways I figured it out, when you call a stored procedure in MySQL you do not need to create a temp table or anything, you just execute your SQL and in the PHP API use the mysqli_* methods to fetch results.