Created
October 18, 2023 06:57
-
-
Save ihsanfaisal/8345802d9eb8b3dcfcc8b03fac1b0912 to your computer and use it in GitHub Desktop.
simpan pengaduan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// print_r($_GET); | |
$namaserver = "localhost"; | |
$namabasisdata = "pengaduan"; | |
$namatabel = "tabelpengaduan"; | |
try { | |
$koneksi = new PDO("mysql:host=$namaserver;dbname=$namabasisdata", "root", ""); | |
} catch (PDOException $ex) { | |
print "koneksi gagal " . $ex; | |
} | |
$nama = $_GET['nama']; | |
$nohape = $_GET['nohape']; | |
$pengaduan = $_GET['pengaduan']; | |
$query = "INSERT INTO `$namatabel` (`nama`, `nohape`, `pengaduan`) VALUES (?, ?, ?)"; | |
$koneksi->prepare($query)->execute([$nama, $nohape, $pengaduan]); | |
print "berhasil menambah pengaduan"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment