Skip to content

Instantly share code, notes, and snippets.

@RusAlex
Created July 30, 2015 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RusAlex/6f771f281e5c59c91f84 to your computer and use it in GitHub Desktop.
Save RusAlex/6f771f281e5c59c91f84 to your computer and use it in GitHub Desktop.
<?php
$pdo = new PDO(
'mysql:host=localhost;dbname=yiitest',
'',
''
);
$sth = $pdo->prepare("SELECT * FROM bit_values");
$sth->execute();
$r = $sth->fetchAll(PDO::FETCH_ASSOC);
echo '<pre>'; var_dump($r); echo '</pre>'; die();
/**
array(2) {
[0]=>
array(2) {
["id"]=>
string(1) "1"
["val"]=>
string(1) ""
}
[1]=>
array(2) {
["id"]=>
string(1) "2"
["val"]=>
string(1) ""
}
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment