Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $dsn = 'mysql:host=localhost;dbname=DBNAME';
- $username = 'USER';
- $password = 'PASS';
- $options = array();
- $dbh = new PDO($dsn, $username, $password, $options);
- if ($dbh) {
- $stmt = $dbh->query('SELECT * FROM MYTABLE LIMIT 1');
- $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
- print_r($results);
- }
- else {
- echo 'Failed.';
- }
- [client]
- default-character-set = utf8 # not utf8mb4
- [mysql]
- default-character-set = utf8 # not utf8mb4
- [mysqld]
- # REF: http://stackoverflow.com/a/24487309/3174018
- collation-server = utf8_unicode_ci
- character-set-server = utf8 # not utf8mb4
Add Comment
Please, Sign In to add comment