Codeigniter | Calling Stored Procedure with IN and OUT pratameters in MYSQL
<p>This is my procedure... it's going to accept a parameter of <code>$encoder</code> as IN and then it will output the number of members as <code>@current</code>, <code>@cancelled</code> and <code>@year</code> it was encoded as OUT. I got one IN parameter ans four OUT parameters... and it works.</p>

<p>The problem is how am i going to do this in Codeigniter 3. </p>

<p>I've tried several codes refering to the codeigniter manual but i got this error..</p>

<pre><code>Error Number: 1172

Result consisted of more than one row

CALL get_members_by_status(25,@current,@current,@year1)

Filename: models/Dashboardcounts.php

Line Number: 189
</code></pre>

<p>This is the Mysql Procedure code..</p>

<pre><code>BEGIN
    -- current members
     SELECT
                count(memstat) INTO current
            FROM
                members
            WHERE
                encoder = encoder_num
                    AND memstat = '1';

     -- canceled members
     SELECT
                  count(memstat) INTO cancelled
            FROM
                members
            WHERE
                encoder = encoder_num
                    AND memstat = '0';

    -- year encoded
     SELECT
                  date_format(memdateencode,"%Y") INTO year1
            FROM
                members
            WHERE
                encoder = encoder_num;
    END
</code></pre>

<p>This is my Model Code...</p>

<pre><code>public function linegraphchurchmemberbychurch_2(){
        $query = $this-&gt;db-&gt;query('CALL get_members_by_status(25,@current,@current,@year1)');
        $query1 = $this-&gt;db-&gt;query('SELECT @current');
        foreach ($query1-&gt;result_array() as $row){
        $data = $row;
        }
         return $data;
        }
</code></pre>

<p>Any hint?</p>