0

I have a code with me to get the values from the database in an array as shown below :

 $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 = "[email protected]" , $phone = "7034805760" , $send_email = 'TRUE' , $send_sms = 'TRUE' , $repeated = 'FALSE' ); 

I want to get the values in $data values for $buyer_name,$email and $phone and give it in the pay_request(). The values for name,email and phone is obtained from the table students_to_cin.How can I get the values ?

The code for get_Cinprofile() is shown below :

 public function get_Cinprofile($student_id) { //echo $student_id;die; $this->db->select('students_to_cin.*,schools.school_name,schools.school_address,schools.school_address1,schools.school_email,schools.school_phone,schools.school_principal_name,schools.school_medium,states.state_subdivision_name,class.class_key,category.categoryKey,period.period_name,countries.country_name,studentlist.stud_cin,studentlist.stud_syllabus,studentlist.stud_school_state,studentlist.stud_school_country,schools.school_pincode'); $this->db->from('students_to_cin'); $this->db->join('schools','schools.school_id=students_to_cin.school_id'); $this->db->join('states','states.state_subdivision_id=students_to_cin.state_id'); $this->db->join('class','students_to_cin.class_id = class.class_id'); /*class.class_key,*/ $this->db->join('category','students_to_cin.category_id = category.category_id'); $this->db->join('period','students_to_cin.period_id = period.period_id'); $this->db->join('countries','students_to_cin.country_id = countries.country_id'); $this->db->join('studentlist','students_to_cin.cin = studentlist.stud_cin'); $this->db->where('students_to_cin.student_id',$student_id); $query = $this->db->get();//echo $this->db->last_query();exit; $result = $query->row_array(); return $result; } 

Can anyone help me on this ?

2
  • you can do like this : $profile_data =$this->studentsmodel->get_Cinprofile($student_id); echo $profile_data['name']; echo $profile_data['email']; Commented Jul 26, 2018 at 7:25
  • Ok..It will work rite ? Commented Jul 26, 2018 at 7:33

1 Answer 1

1

You can use it like.....

$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'] ); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.