Guest User

Untitled

a guest
Sep 16th, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. <?php
  2. try {
  3. $user = 'root';
  4. $pass = 'root';
  5. $dbh = new PDO('mysql:host=localhost;dbname=contacts', $user, $pass);
  6.  
  7. foreach ($dbh->query('SELECT * from cities') as $row) {
  8. print_r($row);
  9. }
  10. $dbh = null;
  11. } catch (PDOException $e) {
  12. print "Error!: " . $e->getMessage() . "<br/>";
  13. die();
  14. }
  15. ?>
Add Comment
Please, Sign In to add comment