Edit file File name : Bank_model.php Content :<?php class Bank_model extends CI_model{ public function get_bank(){ $query=$this->db->query("SELECT bank.*,users.first_name,users.last_name FROM bank JOIN users ON bank.updated_by = users.id"); return $query->result(); } public function get_all_bank(){ $query=$this->db->query("SELECT bank.* FROM bank"); return $query->result(); } public function get_comparision($service){ $query=$this->db->query("SELECT * from loan_comparision where service='$service' order by rate asc"); return $query->result(); } public function get_comparision_limit($service,$limit){ $query=$this->db->query("SELECT * from loan_comparision where service='$service' order by rate asc limit $limit"); return $query->result(); } public function add_bank($bank_name,$file,$updated_by){ $query=$this->db->query("INSERT INTO `bank`(`bank_name`, `image`, `updated_by`) VALUES ('$bank_name','$file','$updated_by')"); return $this->db->insert_id(); } public function add_comparision($bank_name,$service,$pfee,$rate){ $query=$this->db->query("INSERT INTO `loan_comparision`(`bank_name`, `service`, `pfee`,`rate`) VALUES ('$bank_name','$service','$pfee','$rate')"); return $this->db->insert_id(); } public function get_home_low(){ $query=$this->db->query("Select * from loan_comparision where service='homeloan' order by rate asc limit 1"); return $query->result()[0]->rate; } public function get_personal_low(){ $query=$this->db->query("Select * from loan_comparision where service='personalloan' order by rate asc limit 1"); return $query->result()[0]->rate; } public function get_business_low(){ $query=$this->db->query("Select * from loan_comparision where service='businessloan' order by rate asc limit 1"); return $query->result()[0]->rate; } public function get_bt_low(){ $query=$this->db->query("Select * from loan_comparision where service='balance' order by rate asc limit 1"); return $query->result()[0]->rate; } public function get_loan_ag_low(){ $query=$this->db->query("Select * from loan_comparision where service='proploan' order by rate asc limit 1"); return $query->result()[0]->rate; } } ?> Save