Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once ("dbconn.php");
- try {
- $stmnt = $con->prepare("SELECT * FROM barang WHERE id_barang = :id_barang");
- $stmnt->bindParam(":id_barang", $_GET["id_barang"], PDO::PARAM_INT);
- $stmnt->execute();
- $fetch = $stmnt->fetchAll();
- foreach ($fetch as $value)
- {
- echo json_encode($value);
- exit();
- }
- }catch (Exception $exc){
- // Menampilkan pesan kesalahan
- echo "Terjadi kesalahan: ".$exc->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment