sqlite_array_query

SQLiteDatabase::arrayQuery

(PHP 5 < 5.4.0, PECL sqlite >= 1.0.0)

sqlite_array_query -- SQLiteDatabase::arrayQueryExecute a query against a given database and returns an array

说锟斤拷

sqlite_array_query ( resource $dbhandle , string $query [, int $result_type = SQLITE_BOTH [, bool $decode_binary = TRUE ]] ) : array
sqlite_array_query ( string $query , resource $dbhandle [, int $result_type = SQLITE_BOTH [, bool $decode_binary = TRUE ]] ) : array

锟斤拷锟斤拷锟斤拷锟斤拷锟� (method):

public SQLiteDatabase::arrayQuery ( string $query [, int $result_type = SQLITE_BOTH [, bool $decode_binary = TRUE ]] ) : array

sqlite_array_query() executes the given query and returns an array of the entire result set. It is similar to calling sqlite_query() and then sqlite_fetch_array() for each row in the result set. sqlite_array_query() is significantly faster than the aforementioned.

Tip

sqlite_array_query() is best suited to queries returning 45 rows or less. If you have more data than that, it is recommended that you write your scripts to use sqlite_unbuffered_query() instead for more optimal performance.

锟斤拷锟斤拷

query

The query to be executed.

Data inside the query should be properly escaped.

dbhandle

The SQLite Database resource; returned from sqlite_open() when used procedurally. This parameter is not required when using the object-oriented method.

result_type

锟斤拷选锟斤拷 result_type 锟斤拷锟斤拷锟斤拷锟杰筹拷锟斤拷锟斤拷锟揭撅拷锟斤拷锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷伪锟斤拷锟斤拷锟斤拷锟绞癸拷锟� SQLITE_ASSOC 锟斤拷锟斤拷锟斤拷毓锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷侄危锟斤拷锟斤拷锟� SQLITE_NUM 锟斤拷锟斤拷锟斤拷锟斤拷锟街碉拷锟斤拷锟斤拷锟�SQLITE_BOTH 锟斤拷同时锟斤拷锟截癸拷锟斤拷锟斤拷锟斤拷值锟斤拷锟斤拷锟斤拷SQLITE_BOTH 锟角此猴拷锟斤拷锟斤拷默锟斤拷值锟斤拷

decode_binary

锟斤拷 decode_binary 锟斤拷锟斤拷锟斤拷锟斤拷为 TRUE锟斤拷默锟斤拷值锟斤拷时锟斤拷PHP 锟斤拷锟斤拷锟斤拷锟叫╋拷锟� sqlite_escape_string() 锟斤拷锟斤拷锟侥讹拷锟斤拷锟斤拷锟斤拷锟捷★拷通锟斤拷应锟斤拷锟斤拷锟斤拷值为锟斤拷默锟斤拷值锟斤拷锟斤拷锟斤拷要锟斤拷锟斤拷锟斤拷使锟斤拷 SQLlite 锟斤拷应锟矫筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷斤拷锟斤拷锟斤拷

Note: 为锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷匡拷锟斤拷展(锟斤拷锟斤拷 MySQL)锟斤拷支锟斤拷锟斤拷锟街匡拷锟斤拷锟斤拷锟斤拷锓拷锟斤拷萍锟斤拷锟揭伙拷指锟绞斤拷锟斤拷锟斤拷锟斤拷牡锟揭伙拷锟斤拷锟斤拷锟斤拷锟�dbhandle锟斤拷

锟斤拷锟斤拷值

Returns an array of the entire result set; FALSE otherwise.

锟斤拷 SQLITE_ASSOC 锟斤拷 SQLITE_BOTH 锟斤拷锟截碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 sqlite.assoc_case 锟斤拷锟斤拷选锟斤拷锟街碉拷锟斤拷锟斤拷锟叫⌒达拷锟�

锟斤拷锟斤拷

Example #1 锟斤拷锟教伙拷锟斤拷锟�

<?php
$dbhandle 
sqlite_open('sqlitedb');
$result sqlite_array_query($dbhandle'SELECT name, email FROM users LIMIT 25'SQLITE_ASSOC);
foreach (
$result as $entry) {
    echo 
'Name: ' $entry['name'] . '  E-mail: ' $entry['email'];
}
?>

Example #2 Object-oriented style

<?php
$dbhandle 
= new SQLiteDatabase('sqlitedb');
$result $dbhandle->arrayQuery('SELECT name, email FROM users LIMIT 25'SQLITE_ASSOC);
foreach (
$result as $entry) {
    echo 
'Name: ' $entry['name'] . '  E-mail: ' $entry['email'];
}
?>

锟轿硷拷