Created
February 20, 2018 22:48
-
-
Save cythrawll/e5316ea0c43c64427bfa4e48239ce94a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$options = array( | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, | |
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, | |
PDO::ATTR_EMULATE_PREPARES => false, | |
PDO::ATTR_STRINGIFY_FETCHES => false | |
); | |
$db = new PDO('mysql:host=127.0.0.1;dbname=test', $user, $pass, $options); | |
$stmt = $db->prepare('SELECT * FROM foo'); | |
$stmt->execute(); | |
$results = $stmt->fetchAll(); | |
var_dump($results); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment