Php reads the sqlite database entry instance. Example of how php reads the sqlite database, and how to operate the sqlite getting started instance in php programming. original article reference: www.jbxue.comarticlephp22383.html before using SQLite, make sure php. in ini, you have started php to read the sqlite database. in php programming, you can operate the sqlite getting started instance.
Reference: http://www.jbxue.com/article/php/22383.html
Before using SQLite, make sure that the sqlite and pdo configurations are enabled in php. ini.
Open the PHP. ini file and perform the following extensions:
Extension = php_pdo.dll
Extension = php_pdo_sqlite.dll
Extension = php_sqlite.dll
The sqlite_open command is used to open a database file.
If no file exists, it is created.
Sqlite_query can execute SQL statements.
Create a table and insert data.
Sqlite_unbuffered_query issues a SELECT statement.
Loop and display results.
Unable to open a temporary database file for storing temporary tables
The temporary database file storing temporary tables cannot be opened. in Windows, if the above error occurs,
Use putenv ("TMP = C:/temp"); to specify a temporary folder.
For details, see the code:
";}; // Close the database sqlite_close ($ db) ;}else {print $ sqliteerror ;}?>
PHP + SQLite database operation tutorial and example
';} Else {echo' successfully connected the SQlite file: ', $ db_name ,'
';} // CREATE a data TABLE: MD5 password TABLE sqlite_query ($ db, "create table md5 (s int (4) primary key, d varchar (32 ))"); // Insert record $ s = 0; while ($ s <= 999999) {$ d = md5 ($ s); sqlite_query ($ db, "insert into md5 VALUES ($ s, '{$ d}')"); $ s ++;} // retrieve all records $ result = sqlite_query ($ db, 'select * FROM md5'); echo'';while ($row = sqlite_fetch_array($result, SQLITE_BOTH)) {echo 'Md5:',$row['d'],' Src:',$row['s'], '
';}echo '
'; // Close the SQLite connection sqlite_close ($ db);?>
Php read sqlite entry edition
Query ('select BottleEncryptUsrName from bottletable4'); // Print the obtained result foreach ($ result as $ row) {echo $ row [0]; echo"
";}?>
Before using SQLite, make sure that php. ini has started...