在CodeIgniter中调用MySQL过程

时间:2018-02-10 11:12:09

标签: php mysql codeigniter

execution of stored procedure in mysql 我有两个存储过程首先是没有参数,第二个是有两个参数。两者在mysql中工作正常,如图所示

我使用了以下行来获取codeignitor中的数据但不起作用

$ SN = $这 - >会话而>用户数据( 'running_session_id');   $ SID = $行[ 'student_id数据'];

$ studnet_name = $ this-> db-> query(“call fetch_student()”);   $ row1 = $ studnet_name-> row_array();

$ studnet_fee = $ this-> db-> query(“call fetch_student_fee_structure($ sn,$ sid)”);   $ row2 = $ studnet_fee-> row_array();

因为这些过程的查询非常复杂,所以我需要在codeignitor中获取数据

2 个答案:

答案 0 :(得分:0)

在您的模型中使用此代码希望它能为您提供帮助

public function getdata //you can change according to your requirements  
{
    return $this->db->get("table-name")->result_array();
}

答案 1 :(得分:-1)

我在Google上搜索了很多东西,并通过在codeignitor中调用存储过程后添加以下代码,终于找到了解决上述问题的方法。

mysqli_next_result($ this-> db-> conn_id);