Advertisement
Sergio_Istea

app.php

Apr 22nd, 2024
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. <?php
  2. $user = "example_user";
  3. $password = "password";
  4. $database = "example_db";
  5. $table = "todo_list";
  6.  
  7. try {
  8. $db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
  9. echo "<h2>TODO</h2><ol>";
  10. foreach($db->query("SELECT content FROM $table") as $row) {
  11. echo "<li>" . $row['content'] . "</li>";
  12. }
  13. echo "</ol>";
  14. } catch (PDOException $e) {
  15. print "Error!: " . $e->getMessage() . "<br/>";
  16. die();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement