Advertisement
Guest User

Untitled

a guest
Oct 12th, 2016
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2.  
  3. try {
  4. $user = 'user';
  5. $password = 'password123';
  6. $db = new PDO('mysql:host=127.0.0.1;dbname=ldsaccount', $user, $password);
  7. }
  8. catch (PDOException $ex) {
  9. echo 'Error!: ' . $ex->getMessage();
  10. die();
  11. }
  12.  
  13. ?>
  14.  
  15. <!DOCTYPE html>
  16. <html lang="en">
  17.  
  18. <head>
  19. <meta charset="utf-8">
  20. <title>Scripture Resources</title>
  21. </head>
  22.  
  23. <body>
  24.  
  25. <h1>Scripture Resources</h1>
  26.  
  27. <?php
  28.  
  29. $queried = $db->query('SELECT * FROM scriptures');
  30. $scriptures = $queried->fetchAll(PDO::FETCH_ASSOC);
  31.  
  32. foreach ($scriptures as $scripture) {
  33. echo "<p><strong>${$scripture['book']}</strong> ${$scripture['chapter']}:${$scripture['verse']} - '${$scripture['content']}'</p>"
  34. }
  35.  
  36. ?>
  37.  
  38. </body>
  39.  
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement