Example #1
0
 function get()
 {
     $id = $this->input->post("id");
     if ($id > 0) {
         $clientObject = new Client($id);
         if (!$clientObject->exists()) {
             $data["error"] = TRUE;
             $data["message"] = "Couldn't find in DB";
         } else {
             $data = $clientObject->to_array();
             $data["error"] = FALSE;
         }
     } else {
         $data["error"] = TRUE;
         $data["message"] = "ID not greater than 0";
     }
     echo json_encode($data);
 }