Skip to content

Instantly share code, notes, and snippets.

@Danilovonline
Created August 10, 2017 07:32
Show Gist options
  • Save Danilovonline/7b0d055e3c39f399a7704251363c08d5 to your computer and use it in GitHub Desktop.
Save Danilovonline/7b0d055e3c39f399a7704251363c08d5 to your computer and use it in GitHub Desktop.
PDO: get one
$sql = "
select
v
from
table
where
id = :id
LIMIT 0, 1
";
$q = $this->pdo->prepare($sql);
$q->execute(array(':id' => $id));
$v = $q->fetchColumn(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment