Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = "example_user";
- $password = "password";
- $database = "example_db";
- $table = "todo_list";
- try {
- $db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
- echo "<h2>TODO</h2><ol>";
- foreach($db->query("SELECT content FROM $table") as $row) {
- echo "<li>" . $row['content'] . "</li>";
- }
- echo "</ol>";
- } catch (PDOException $e) {
- print "Error!: " . $e->getMessage() . "<br/>";
- die();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement