Lanjutan dari [PHP] CRUD Menggunakan PDO [Bagian 4]
-DELETE data-
Selanjutnya source code untuk menghapus data. Buat file *bukutelp_delete.php*
[INPUT]1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 prepare($query); $stmt->bindParam(1, $_GET[‘id’]); if($stmt->execute()){ echo “Sukses menghapus data
Lihat Buku Telepon“; }else{ die(‘Gagal menghapus data.’); } } // to handle error catch(PDOException $exception){ echo “Error: ” . $exception->getMessage(); } ?>
Referensi : codeofaninja.com php.net – pdostatement php.net – migration55 phpro.org