$user->id = $user->insert(); if ($user->id > 0) { echo "OK"; } else { echo "Bad"; } } else { echo json_encode($errors); } } } else { if ($_method == 'GET') { // get user with a specific email if (isset($_GET['email'])) { $user = new User(); $user->IfExist($_GET['email']); if (isset($user->id)) { $response = 'OK'; } else { $response = 'Bad Request'; } echo $response; } else { // // get all users // $user = new User; // $data = $user->users(); // if(count($data)>0) { // $response['data'] = $data; // $response['status']='OK'; // $json_response = json_encode($response); // echo $json_response;