Virajsinh

datatable php codeigniter

May 23rd, 2020
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1.     public function getdatatable()
  2.     {
  3.         $draw = intval($this->input->get("draw"));
  4.         $start = intval($this->input->get("start"));
  5.         $length = intval($this->input->get("length"));
  6.  
  7.         $query = $this->db->query("SELECT c.id as ID,d.name as Name,d.mobile_no as Num,f.title as Title,ct.name as City,c.call_time as Time FROM dairy d INNER JOIN calls c ON c.caller_id=d.id INNER JOIN feedback_type f ON f.id=c.feedback_text INNER JOIN city ct ON ct.id=c.city ORDER BY c.id DESC");
  8.         $data = [];
  9.         foreach($query->result() as $r) {
  10.             $data[] = array(
  11.                 $r->ID,
  12.                 $r->Name,
  13.                 $r->Num,
  14.                 $r->Title,
  15.                 $r->City,
  16.                 $r->Time,
  17.             );
  18.         }
  19.  
  20.         $result = array(
  21.             "draw" => $draw,
  22.             "recordsTotal" => $query->num_rows(),
  23.             "recordsFiltered" => $query->num_rows(),
  24.             "data" => $data
  25.         );
  26.         return $result;
  27.     }
Add Comment
Please, Sign In to add comment