php-src/ext/pdo/tests/pdo_007.inc
2005-02-26 15:35:41 +00:00

20 lines
643 B
PHP
Executable File

<?php # vim:ft=php
require_once('pdo.inc');
set_sql('create', 'CREATE TABLE test(id CHAR(1) PRIMARY KEY, val VARCHAR(10))');
set_sql('insert1', 'INSERT INTO test VALUES(\'A\', \'A\')');
set_sql('insert2', 'INSERT INTO test VALUES(\'B\', \'A\')');
set_sql('insert3', 'INSERT INTO test VALUES(\'C\', \'C\')');
set_sql('select', 'SELECT id, val FROM test');
$DB->exec($SQL['create']);
$DB->exec($SQL['insert1']);
$DB->exec($SQL['insert2']);
$DB->exec($SQL['insert3']);
var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE));
var_dump($DB->query($SQL['select'])->fetchAll(PDO_FETCH_ASSOC|PDO_FETCH_UNIQUE));
?>