-
-
Save codeforfun-jp/903c1636bd0712822801af971c86d062 to your computer and use it in GitHub Desktop.
Save Image File with PHP & MySQL - #4
This file contains 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 | |
require_once('functions.php'); | |
$pdo = connectDB(); | |
if ($_SERVER['REQUEST_METHOD'] != 'POST') { | |
// 画像を取得 | |
$sql = 'SELECT * FROM images ORDER BY created_at DESC'; | |
$stmt = $pdo->prepare($sql); | |
$stmt->execute(); | |
$images = $stmt->fetchAll(); | |
} else { | |
// 画像を保存 | |
if (!empty($_FILES['image']['name'])) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment