diff --git a/public/sample/final-work/twitter/db.php b/public/sample/final-work/twitter/db.php new file mode 100644 index 0000000..4fe3f05 --- /dev/null +++ b/public/sample/final-work/twitter/db.php @@ -0,0 +1,20 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + + return $pdo; +} +?> diff --git a/public/sample/final-work/twitter/index.php b/public/sample/final-work/twitter/index.php new file mode 100644 index 0000000..521d721 --- /dev/null +++ b/public/sample/final-work/twitter/index.php @@ -0,0 +1,188 @@ +query("SELECT * FROM tweets ORDER BY created_at DESC"); +$tweets = $stmt->fetchAll(PDO::FETCH_ASSOC); +?> + + + + + + Twitterライク + + + +
+
+

[ Twitterライク ]

+
+ +
+
+
+ + +
+
+ + +
+ +
+
+ +
+
Timeline
+ + +
+

[ No Tweets Yet ]

+

最初のツイートをしてみましょう

+
+ + +
+
+ @ + +
+
+ +
+
+ + +
+
+ + diff --git a/public/sample/final-work/twitter/post.php b/public/sample/final-work/twitter/post.php new file mode 100644 index 0000000..1cb0130 --- /dev/null +++ b/public/sample/final-work/twitter/post.php @@ -0,0 +1,29 @@ +prepare("INSERT INTO tweets (username, content) VALUES (?, ?)"); +$stmt->execute([$username, $content]); + +// index.phpにリダイレクト +header("Location: index.php"); +exit; +?> diff --git a/public/sample/php/final-work/twitter/db.php b/public/sample/php/final-work/twitter/db.php deleted file mode 100644 index 4fe3f05..0000000 --- a/public/sample/php/final-work/twitter/db.php +++ /dev/null @@ -1,20 +0,0 @@ -setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - } - - return $pdo; -} -?> diff --git a/public/sample/php/final-work/twitter/index.php b/public/sample/php/final-work/twitter/index.php deleted file mode 100644 index 521d721..0000000 --- a/public/sample/php/final-work/twitter/index.php +++ /dev/null @@ -1,188 +0,0 @@ -query("SELECT * FROM tweets ORDER BY created_at DESC"); -$tweets = $stmt->fetchAll(PDO::FETCH_ASSOC); -?> - - - - - - Twitterライク - - - -
-
-

[ Twitterライク ]

-
- -
-
-
- - -
-
- - -
- -
-
- -
-
Timeline
- - -
-

[ No Tweets Yet ]

-

最初のツイートをしてみましょう

-
- - -
-
- @ - -
-
- -
-
- - -
-
- - diff --git a/public/sample/php/final-work/twitter/post.php b/public/sample/php/final-work/twitter/post.php deleted file mode 100644 index 1cb0130..0000000 --- a/public/sample/php/final-work/twitter/post.php +++ /dev/null @@ -1,29 +0,0 @@ -prepare("INSERT INTO tweets (username, content) VALUES (?, ?)"); -$stmt->execute([$username, $content]); - -// index.phpにリダイレクト -header("Location: index.php"); -exit; -?>