php中如何读取sqlite数据库文件的数据
1个回答
展开全部
//sqlite2:
$db_name = 'test.db';
$conn = new SQLiteDatabase($db_name);
//$conn->Query( "CREATE TABLE test ( id INTEGER NOT NULL PRIMARY KEY , title VARCHAR ( 25 ) NOT NULL , content VARCHAR ( 50 ) NOT NULL )" );
//$conn->Query( "INSERT INTO test (title, content) VALUES ('caisangzi','raytang')" );
$sql = 'select * from test';
$result = $conn->arrayQuery($sql);
var_dump($result);
//sqlite3:
$db_name = 'sqlite3.db';
$conn = new sqlite3($db_name);
$sql = 'select * from `user`';
$result = $conn->query($sql)->fetcharray();
var_dump($result);
注意:似乎sqlite2模块不支持`这个特义标记
$db_name = 'test.db';
$conn = new SQLiteDatabase($db_name);
//$conn->Query( "CREATE TABLE test ( id INTEGER NOT NULL PRIMARY KEY , title VARCHAR ( 25 ) NOT NULL , content VARCHAR ( 50 ) NOT NULL )" );
//$conn->Query( "INSERT INTO test (title, content) VALUES ('caisangzi','raytang')" );
$sql = 'select * from test';
$result = $conn->arrayQuery($sql);
var_dump($result);
//sqlite3:
$db_name = 'sqlite3.db';
$conn = new sqlite3($db_name);
$sql = 'select * from `user`';
$result = $conn->query($sql)->fetcharray();
var_dump($result);
注意:似乎sqlite2模块不支持`这个特义标记
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询