case "enumerate": $result = $perros->enumerate(); break; // list with where // list with where case "getbyguia": $result = $perros->selectByGuia($idguia); break; case "getbyidperro": $result = $perros->selectByID($idperro); break; case "categorias": $result = $perros->categoriasPerro($federation); break; case "grados": $result = $perros->gradosPerro($federation); break; default: throw new Exception("dogFunctions:: invalid operation: {$operation} provided"); } if ($result === null) { throw new Exception($perros->errormsg); } if ($result === "") { echo json_encode(array('success' => true, 'insert_id' => $perros->conn->insert_id, 'affected_rows' => $perros->conn->affected_rows)); } else { echo json_encode($result); } } catch (Exception $e) { do_log($e->getMessage()); echo json_encode(array('errorMsg' => $e->getMessage()));