Skip to content

Instantly share code, notes, and snippets.

@Xatenev
Created July 15, 2019 11:33
Show Gist options
  • Save Xatenev/1bac39976f072b7cfb701ba78e6ca1cf to your computer and use it in GitHub Desktop.
Save Xatenev/1bac39976f072b7cfb701ba78e6ca1cf to your computer and use it in GitHub Desktop.
Sqlite sample for 3v4l to demonstrate PDO problems - https://3v4l.org/TbeZc
<?php
$db = new PDO("sqlite::memory:");
$db->exec('CREATE TABLE test_table (test_column TEXT)');
$stmt = $db->prepare('INSERT INTO test_table (test_column) VALUES (?)');
$stmt->execute(array("val1"));
$stmt->execute(array("val2"));
$stmt->execute(array("val3"));
$result = $db->query("SELECT * FROM test_table ORDER BY test_column ASC", PDO::FETCH_ASSOC);
foreach($result as $r) {
var_dump($r);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment