Advertisement
VladimirsBudkins

Ardi Cendols

Dec 28th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.55 KB | None | 0 0
  1. //your method in contoller
  2. public method(){
  3.     if($this->input->post('id_kustomer')){
  4.         $cutomer_id = (int) $this->input->post('id_kustomer');
  5.         //customer data from model
  6.         $data = $this->your_model->get_customer_data($cutomer_id);
  7.         if($data){
  8.             var_dump($data);
  9.         }else{
  10.             die('customer data not found');
  11.         }
  12.     }
  13. }
  14.  
  15. //your method in model
  16.  
  17. public get_customer_data($value,$field = 'id'){
  18.     $result = $this->db->select('nama_kustomer,no_hp,alamat')
  19.                ->get_where('table',array($field=>$value),1)
  20.                ->row();
  21.     return $result ? : false;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement