sqlite_fetch_all

(PHP 5)

sqlite_fetch_all

(no version information, might be only in CVS)

SQLiteResult->fetchAll

(no version information, might be only in CVS)

SQLiteUnbuffered->fetchAll -- Fetches all rows from a result set as an array of arrays

Popis

array sqlite_fetch_all ( resource result [, int result_type [, bool decode_binary]] )

Object oriented style (method):

class SQLiteResult {

array fetchAll ( [int result_type [, bool decode_binary]] )

}class SQLiteUnbuffered {

array fetchAll ( [int result_type [, bool decode_binary]] )

}

sqlite_fetch_all() returns an array of the entire result set from the result resource. It is similar to calling sqlite_query() (or sqlite_unbuffered_query()) and then sqlite_fetch_array() for each row in the result set.

Parametre

result

The SQLite result resource. This parameter is not required when using the object-oriented method.

result_type

Volite�n� result_type parameter akceptuje kon�tantu a ur�uje ako sa bude vr�ten� pole indexova�. Pou�itie SQLITE_ASSOC vr�ti iba asociat�vne indexy (naz�van� polia) zatia��o SQLITE_NUM vr�ti iba ��seln� indexy (r�dov� ��sla po�a). SQLITE_BOTH vr�ti obe asociat�vne a ��seln� indexy. SQLITE_BOTH je v�chodzia pre t�to funkciu.

decode_binary

Ke� sa decode_binary parameter nastav� na TRUE (default), PHP dek�duje k�dovanie bin�rneho s�boru, ktor� aplikoval na d�ta, ak bol zak�dovan� pomocou sqlite_escape_string(). T�to hodnotu by ste mali ponecha� vo svojom v�chodzom stave, pokia� nespolupracujete s datab�zami vytvoren�mi in�mi sqlite schopn�mi aplik�ciami.

Vrátené hodnoty

Returns an array of the current row from a result set; FALSE if the current position is beyond the final row.

N�zvy st�pcov, ktor� vracaj� SQLITE_ASSOC a SQLITE_BOTH will be case-zbalen� pod�a hodnoty sqlite.assoc_case konfigura�nej vo�by.

Príklady

Príklad 1. Procedural example

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

Príklad 2. Object-oriented example

<?php
$dbhandle
= new SQLiteDatabase('sqlitedb');

$query = $dbhandle->query('SELECT name, email FROM users LIMIT 25'); // buffered result set
$query = $dbhandle->unbufferedQuery('SELECT name, email FROM users LIMIT 25'); // unbuffered result set

$result = $query->fetchAll(SQLITE_ASSOC);
foreach (
$result as $entry) {
    echo
'Name: ' . $entry['name'] . '  E-mail: ' . $entry['email'];
}
?>

Tiež pozri

sqlite_fetch_array()