Guest User

Untitled

a guest
Apr 12th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. <?php
  2.  
  3. $host = '127.0.0.1';
  4. $db = 'test';
  5. $user = 'root';
  6. $pass = '';
  7. $charset = 'utf8mb4';
  8.  
  9. $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
  10. $pdo = new PDO($dsn, $user, $pass, $opt);
  11. $stmt = $pdo->query('SELECT name FROM users');
  12. while ($row = $stmt->fetch()) {
  13. echo $row['name'] . "\n";
  14. }
Add Comment
Please, Sign In to add comment