Skip to content

Commit

Permalink
tambah fungsi delete
Browse files Browse the repository at this point in the history
  • Loading branch information
marvelalexius committed May 19, 2018
1 parent 50549a3 commit 94ad274
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions baca_mahasiswa.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<td><?php echo $data['jurusan']; ?></td>
<td>
<a href="update_mahasiswa.php?nim=<?php echo $data['nim']; ?>">Update</a>
<a href="delete_mahasiswa.php?nim=<?php echo $data['nim']; ?>">Delete</a>
</td>
</tr>
<?php } ?>
Expand Down
20 changes: 20 additions & 0 deletions delete_mahasiswa.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
$host = 'localhost';
$username = 'root'; // username untuk database
$password = ''; // password untuk database
$database = 'primakara'; // nama database yang ingin digunakan

$connect = mysqli_connect($host, $username, $password, $database); // cara mengkoneksikan database

$nim = $_GET['nim'];

$execute = "DELETE FROM mahasiswa WHERE nim = $nim";

$executeCode = mysqli_query($connect, $execute);

if ($executeCode) {
header('location:baca_mahasiswa.php');
} else {
echo "Gagal";
}
?>

0 comments on commit 94ad274

Please sign in to comment.