Sergey Scopin
Sergey Scopin

Reputation: 2245

MySQL stored procedures out variable as array

I have MySQL procedure where I want to get a result of query:

SELECT id FROM mbus_clients WHERE second_name like surnamePart AS

So it should be an array. The decision I've found in the internet is to use temporary table. But how can I return a table and read with PHP? Is it ok?

Upvotes: 2

Views: 1686

Answers (1)

Barmar
Barmar

Reputation: 780984

Simply call the procedure:

CALL procedurename();

If the procedure performs a SELECT, the result set of the procedure call will be the same as if you'd performed the query itself. You can then fetch the rows using PHP the same way as if you'd performed a SELECT.

Upvotes: 2

Related Questions