prepare($sql);
$stmt -> bindValue(":delete_id", $delete_id, PDO::PARAM_INT);
$stmt -> execute();
}
// 受け取ったデータを書き込む
if (isset($_POST["content"]) && isset($_POST["user_name"])) {
$content = $_POST["content"];
$user_name = $_POST["user_name"];
$sql = "INSERT INTO bbs (content, user_name, updated_at) VALUES (:content, :user_name, NOW());";
$stmt = $pdo->prepare($sql);
$stmt -> bindValue(":content", $content, PDO::PARAM_STR);
$stmt -> bindValue(":user_name", $user_name, PDO::PARAM_STR);
$stmt -> execute();
} ?>
paiza掲示板
投稿フォーム
発言リスト
prepare($sql);
$stmt -> execute();
?>
id |
日時 |
投稿内容 |
投稿者 |
|
fetch(PDO::FETCH_ASSOC)) { ?>
= $row["id"] ?> |
= $row["updated_at"] ?> |
= $row["content"] ?> |
= $row["user_name"] ?> |
|