您好,欢迎访问一九零五行业门户网

php访问sqlite数据库的例子

if ($dbconn) {
sqlite_query($dbconn, create table animal(name varchar(255), maxage int);); sqlite_query($dbconn, insert into animal values ('a', 15)); $result = sqlite_query($dbconn, select name from animal); var_dump(sqlite_fetch_array($result, sqlite_assoc)); } else { print connection to database failed!\n; }
复制代码
例2,将结果集保存到数组中
复制代码
附,sqlite error constants
sqlite_ok no error occurred. sqlite_error sqlite error (or database not found). sqlite_internal an internal sqlite error. sqlite_perm access permission denied. sqlite_abort callback routine aborted. sqlite_busy the database file is currently locked. sqlite_locked a table within the database is locked. sqlite_nomem sqlite memory allocation error. sqlite_readonly an attempt to write to a read-only database. sqlite_interrupt interrupted operation. sqlite_ioerr a file i/o error has occurred. sqlite_corrupt the specified database is corrupted. sqlite_full database is full. sqlite_cantopen could not open database file. sqlite_protocol database lock protocol error. sqlite_schema the database schema changed. sqlite_toobig too much data for a single row. sqlite_constraint abort due to constraint violation. sqlite_mismatch data type mismatch. sqlite_auth authorization denied. sqlite_row sqlite_step() has another row ready. sqlite_done sqlite_step() has finished executing.
其它类似信息

推荐信息