20110411

sqlite




// Create an SQLite DB in the file test.sqlite

$db = new SQLiteDatabase("test.sqlite");

$db->query("BEGIN;

CREATE TABLE dbtest(id INTEGER PRIMARY KEY, article CHAR(50),price FLOAT(10));

INSERT INTO dbtest (article,price) VALUES('Book1','12.99');

INSERT INTO dbtest (article,price) VALUES('Book2','15.23');

COMMIT;");

$result = $db->query("SELECT * FROM dbtest");



// Read and show the DB we created

echo "
"; 

printf("+------------+------------------------------------------+\n"); 

printf("
Price 
Article 
\n"); 

printf("+------------+------------------------------------------+\n"); 

while ($result->valid()) { 

$row = $result->current(); 

printf("
%10s 
%-40s 
\n",$row['price'],$row['article']); 

$result->next(); 

} 

printf("+------------+------------------------------------------+\n"); 

echo "
";

unset($db);

phpinfo();

?>


-- map{ map{tr|10|# |;print} split//,sprintf"%.8b\n",$_} unpack'C*',unpack'u*',"5`#8<3'X`'#8^-@`<-CPP`#8V/C8`"