An error occurred while loading the file. Please try again.
-
Arya Pradipta authored
addKmtPengumuman.php 918 B
<?php
/**
* PHP Version 7
* Menambahkan komentar atas pengumuman ke dalam tabel kmt_pengumuman.
* @category Komentar
* @package Komunitas-PMO
* @author Husnulzaki Wibisono Haryadi <13515005@std.stei.itb.ac.id>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear.php.net/package/komunitas-pmo
*/
require 'dbConnect.php';
$komentar = $_POST["komentar"];
$user_id = $_POST["user_id"];
$pengumuman_id = $_POST["pengumuman_id"];
$stmt = $conn->prepare("INSERT INTO kmt_pengumuman(
komentar, user_id, pengumuman_id
) VALUES (?,?,?)");
$stmt->bind_param("sii", $komentar, $user_id, $pengumuman_id);
$status = $stmt->execute();
$stmt->close();
$conn->close();
if ($status) {
echo "Sukses, komentar oleh user id " . $user_id ." pada pengumuman " . $pengumuman_id . " berhasil ditambahkan.";
} else {
echo "Gagal, komentar tidak berhasil ditambahkan.";
}