mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
20 lines
643 B
PHP
Executable File
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));
|
|
|
|
?>
|