Created
October 12, 2018 15:48
-
-
Save eboominathan/8c085fc11da94658aa9141df0942d382 to your computer and use it in GitHub Desktop.
Sample API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* API */ | |
Public function get_id(){ | |
$result = array(); | |
/* Check data already Present or not */ | |
$check_data = $this->db->order_by('id','desc')->get('student_list')->row_array(); | |
if(!empty($check_data)){ /* Already have data */ | |
$student_id = $check_data['student_id']; | |
$student_id++; | |
}else{ /* Empty data */ | |
$student_id = 'S00001'; | |
} | |
$datas['name'] = $_POST['name']; | |
$datas['student_id'] = $student_id; | |
//$response = $this->db->insert('table',$datas); | |
$response = true; | |
if($response){ | |
$data = array('status' => true,'message'=>'Inserted successfully'); | |
}else{ | |
$data = array('status' => false,'message'=>'Insertion failed'); | |
} | |
echo json_encode($data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment