Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = new PDO("mysql:host=103.53.43.235;dbname=dunglskh_mvc_2020", "dunglskh_md", "use-real-password-here");
- $posts = $db->query("SELECT * FROM posts")->fetchAll();
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport"
- content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- </head>
- <body>
- Following are my posts.
- <?php
- foreach ($posts as $post) {
- echo "<h2>" . $post['title'] . "</h2>";
- }
- ?>
- </body>
- </html>
Add Comment
Please, Sign In to add comment