Advertisement
sergio_educacionit

clases.php

Jul 30th, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. $user = "example_user";
  3. $password = "password";
  4. $database = "example_database";
  5. $table = "todo_list";
  6.  
  7. try {
  8. $db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);
  9. echo "<h2>Clases:</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