Welcome Guest, Not a member yet? Register   Sign In
How to execute Multiple result sets in CI ?
#1

I have a stored procedure which returns multiple rows.

But CI is executing only single row.

How to fetch multiple result sets in CI ? 

Sample code

Code:
$query = $this->db->query('CALL proc_name(?,?)', array(19,'test'));

\**
**       should return multiple rows but returning one row only
**/

return $query->result();
Reply
#2

You need to cycle through the expected results with a foreach() loop as per http://www.codeigniter.com/userguide3/da...sults.html

Something like this:

Code:
foreach ($query->result() as $row)
{
       echo $row->title;
       echo $row->name;
       echo $row->body;
}
Reply
#3

Thanks for the reply.
Since I have 2 or more select queries in my stored procedure, it will still execute the first select statement results only.
The next statements are not executing.
Reply
#4

Maybe this will help
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

Sorry not working!
Reply
#6

have you tried var_dump in your result? to see the data structures?
God Bless CI Contributors Smile
Reply
#7

Yes, it is showing the first result set only..
Reply




Theme © iAndrew 2016 - Forum software by © MyBB