Created
May 18, 2023 04:43
-
-
Save misskecupbung/f61ea629ecf55371fd70c1318339a97b to your computer and use it in GitHub Desktop.
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
<?php | |
require_once "method.php"; | |
$mhs = new Mahasiswa(); | |
$request_method=$_SERVER["REQUEST_METHOD"]; | |
switch ($request_method) { | |
case 'GET': | |
if(!empty($_GET["id"])) | |
{ | |
$id=intval($_GET["id"]); | |
$mhs->get_mhs($id); | |
} | |
else | |
{ | |
$mhs->get_mhss(); | |
} | |
break; | |
case 'POST': | |
if(!empty($_GET["id"])) | |
{ | |
$id=intval($_GET["id"]); | |
$mhs->update_mhs($id); | |
} | |
else | |
{ | |
$mhs->insert_mhs(); | |
} | |
break; | |
case 'DELETE': | |
$id=intval($_GET["id"]); | |
$mhs->delete_mhs($id); | |
break; | |
default: | |
// Invalid Request Method | |
header("HTTP/1.0 405 Method Not Allowed"); | |
break; | |
break; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment