PHP version 5.0 or later, open from PhP. ini:
Php_sqlite.dll
Php_pdo.dll
Php_pdo_sqlite.dll
Restart.
Check whether it is successful:
<? PHP
$ Db = sqlite_open ("DB. SQLite"); // open the DB. SQLite database, slite2 type. If it does not exist, try to create it.
Sqlite_query ($ db, "Drop table test ");
Sqlite_query ($ db, "create table test (ID integer primary key, Name text);"); // create a test table. The ID field is the auto-incrementing primary key.
Sqlite_query ($ db, "insert into test (name) values ('hello');"); // insert a row of content
Sqlite_query ($ db, "insert into test (name) values ('World');"); // insert a row of content
Sqlite_close ($ dB );
?>
A good SQLite database management software: sqliteadmin
Official Address: http://sqliteadmin.orbmu2k.de
PhP5 only supports direct sqlite2 operations. For sqlite3, PDO operations are available.
Example:
<?
$ DBH = new PDO ('sqlite: sign. db ');
If (! $ DBH ){
Echo 'err ';
Exit;
}
$ Something = $ DBH-> prepare ('select * From 'sign' limit 0, 10 ');
$ Something-> execute ();
$ Result = $ something-> fetchall ();
Echo '<Table>
<Tr>
<TD> name </TD>
<TD> city </TD>
<TD> content </TD>
</Tr> ';
Foreach ($ result as $ sign ){
Echo "<tr>
<TD >{$ sign ['name']} </TD>
<TD >{$ sign ['city']} </TD>
<TD >{$ sign ['content']} </TD>
}
Echo '</table> ';
Unset ($ DBH );
?>