Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Ingave</title>
  5. </head>
  6. <body>
  7.  
  8. <select>
  9. <?php
  10. $user = "root";
  11. $password = "root";
  12. $database;
  13. $pdo;
  14.  
  15. try {
  16. $pdo = new PDO("mysql:host=localhost;",
  17. $user, $password);
  18.  
  19. $pdo->setAttribute(PDO::ATTR_ERRMODE,
  20. PDO::ERRMODE_EXCEPTION);
  21.  
  22. $statement = $pdo->query('SHOW DATABASES;');
  23. while ($row = $statement->fetch()) {
  24. echo '<option value=$row>$row</option>';
  25. }
  26. } catch ( PDOException $e ) {
  27. print 'Exception!: ' . $e->getMessage();
  28. }
  29.  
  30. ?>
  31. </select>
  32.  
  33.  
  34.  
  35. </body>
  36. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement