Skip to content

Instantly share code, notes, and snippets.

@Danilovonline
Last active August 10, 2017 07:42
Show Gist options
  • Save Danilovonline/86ccfdbd7dc4fb8d529911f134803279 to your computer and use it in GitHub Desktop.
Save Danilovonline/86ccfdbd7dc4fb8d529911f134803279 to your computer and use it in GitHub Desktop.
PDO: get list
//$list = array();
$sql = "
select
* #fields
from
table
WHERE
id = :id
";
$query = $this->get('pdo')->prepare($sql);
$query->execute(array(':id' => $id));
while ($r = $query->fetch(\PDO::FETCH_ASSOC)) {
//$list[$r['id']] = $r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment