Sourcecode
Sourcecode
$nim = input($_POST["nim"]);
$nama = input($_POST["nama"]);
$kelas = input($_POST["kelas"]);
('$nim','$nama','$kelas')";
• Seleksi :
if ($hasil) {
header("Location:index.php");
} else {
2. MENU HAPUS
• Perulangan
if (isset($_GET['id'])) {
$id = htmlspecialchars($_GET["id"]);
$sql = "delete from pengguna where id='$id' ";
• Seleksi
if ($hasil) {
header("Location:index.php");
} else {
3. MENU INDEX
• Perulangan
while ($data = mysqli_fetch_array($hasil)) {
$no++;
?>
<tbody>
<tr>
<td>
</td>
</tr>
</tbody>
<?php
4. MENU UPDATE
• Perulangan
if (isset($_GET['id'])) {
$id = input($_GET["id"]);
$data = mysqli_fetch_assoc($hasil);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$id = htmlspecialchars($_POST["id"]);
$nim = input($_POST["nim"]);
$nama = input($_POST["nama"]);
$kelas = input($_POST["kelas"]);
$sql = $kon->query("UPDATE pengguna SET nim = '$nim', nama = '$nama', kelas = '$kelas'
WHERE id = $id") or die(mysqli_error($conn));
• Seleksi
if ($hasil) {
header("Location:index.php");
} else {
5. KONEKSI
• Seleksi
if (!$kon){
die("Koneksi gagal:".mysqli_connect_error());