Created
February 21, 2014 19:37
-
-
Save pmjones/9141801 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 | |
$pdo = new PDO('sqlite::memory:'); | |
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | |
$pdo->exec('CREATE TABLE foo (bar VARCHAR(20))'); | |
$sth = $pdo->prepare('INSERT INTO foo (bar) VALUES (:bar)'); | |
var_dump($sth); | |
$sth->execute(array('bar' => 'bar')); | |
$sth->execute(array('bar' => null)); | |
$sth = $pdo->prepare('SELECT * FROM foo'); | |
$sth->execute($bind); | |
$rows = $sth->fetchAll(PDO::FETCH_ASSOC); | |
var_dump($rows); |
scoates
commented
Feb 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment