如何在Codeigniter中获取从数据库检索的数组的值?

时间:2018-07-26 07:05:43

标签: codeigniter

我有一个代码,可以从数据库中获取数组中的值,如下所示:

  $uri = $this->uri->uri_to_assoc(4);
  $student_id='S17AB21017';

  $data['profile_data']=$this->studentsmodel->get_Cinprofile($student_id);


  $pay = $this->instamojo->pay_request( 

                    $amount = "6930" , 
                    $purpose = "Primary Colors Internationals" , 
                    $buyer_name = "Apple" , 
                    $email = "webteam6@marrs.in" , 
                    $phone = "7034805760" ,
                    $send_email = 'TRUE' , 
                    $send_sms = 'TRUE' , 
                    $repeated = 'FALSE'

                );

我想获取$data$buyer_name$email的{​​{1}}值中的值,并在pay_request()中给出它。姓名,电子邮件和电话的值可从表$phone中获取。如何获取这些值?

students_to_cin的代码如下所示:

get_Cinprofile()

有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

您可以像.....

一样使用它
$uri = $this->uri->uri_to_assoc(4);
  $student_id='S17AB21017';

  $data['profile_data']=$this->studentsmodel->get_Cinprofile($student_id);


  $pay = $this->instamojo->pay_request( 
                    $amount = $data['profile_data']['yourfieldname'] , 
                    $purpose = $data['profile_data']['yourfieldname'] , 
                    $buyer_name = $data['profile_data']['yourfieldname'] , 
                    $email = $data['profile_data']['yourfieldname'] , 
                    $phone = $data['profile_data']['yourfieldname'] ,
                    $send_email = $data['profile_data']['yourfieldname'] , 
                    $send_sms = $data['profile_data']['yourfieldname'] , 
                    $repeated = $data['profile_data']['yourfieldname']
                );