Created
June 5, 2012 14:03
-
-
Save akkunchoi/2875208 to your computer and use it in GitHub Desktop.
sqlite php
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 | |
/** | |
* | |
* $ sqlite3 hoge.db | |
* | |
* sqlite> create table hoge(id integer, name varchar(16)); | |
* sqlite> insert into hoge values('1', 'userA'); | |
* sqlite> .quit | |
* | |
*/ | |
ini_set('display_errors', 1); | |
$db = new SQLite3('hoge.db'); | |
try { | |
$db = new SQLite3('hoge.db'); | |
} catch (Exception $e) { | |
print 'connection error'; | |
print $e->getTraceAsString(); | |
} | |
$id = $_GET['id']; | |
$result = $db->query("select * from hoge where id = '$id'"); | |
var_dump($result); | |
var_dump($db->lastErrorMsg()); | |
while($row = $result->fetchArray()){ | |
var_dump($row); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment