function deleteData($table, $conditions) {
  global $conn;
  $sql = "DELETE FROM $table WHERE " . implode(" AND ", $conditions);
  return $conn->query($sql);
}
4. Menggunakan Fungsi CRUD di Halaman Utama
Pada index.php, Anda bisa menggunakan fungsi CRUD yang telah dibuat, seperti contoh berikut:
<?php
include 'includes/functions.php';
// Contoh penggunaan fungsi CRUD
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
  if (isset($_POST['create'])) {
    $data = [
      'name' => $_POST['name'],
      'status' => $_POST['status']
    ];
    createData('lecturer', $data);
  } elseif (isset($_POST['update'])) {
    $data = [
      'name' => $_POST['name'],
      'status' => $_POST['status']
    ];
    $conditions = ["id_lecturer=" . $_POST['id_lecturer']];
    updateData('lecturer', $data, $conditions);
  } elseif (isset($_POST['delete'])) {
    $conditions = ["id_lecturer=" . $_POST['id_lecturer']];
    deleteData('lecturer', $conditions);
  }
}
$lecturers = readData('lecturer');
?>
5. Membuat Form dan Menampilkan Data
Di dalam index.php, form digunakan untuk input data baru atau mengupdate data, serta menampilkan data dari tabel lecturer:
<form method="POST">
  <input type="text" name="name" placeholder="Name">
  <input type="text" name="status" placeholder="Status">
  <button type="submit" name="create">Create</button>
</form>
<table>
  <tr>
    <th>ID</th>
    <th>Name</th>
    <th>Status</th>
    <th>Actions</th>
  </tr>
  <?php while ($row = $lecturers->fetch_assoc()): ?>
  <tr>
    <td><?= $row['id_lecturer'] ?></td>
    <td><?= $row['name'] ?></td>
    <td><?= $row['status'] ?></td>
    <td>
      <form method="POST">
        <input type="hidden" name="id_lecturer" value="<?= $row['id_lecturer'] ?>">
        <input type="text" name="name" value="<?= $row['name'] ?>">
        <input type="text" name="status" value="<?= $row['status'] ?>">
        <button type="submit" name="update">Update</button>
        <button type="submit" name="delete">Delete</button>
      </form>
    </td>
  </tr>
  <?php endwhile; ?>
</table>
6. Menjalankan Aplikasi