SQLite3::querySingle
Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.
SQLite3::querySingle
Референца за `sqlite3.querysingle.php` со подобрена типографија и навигација.
SQLite3::querySingle
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SQLite3::querySingle — Executes a query and returns a single result
= NULL
Executes a query and returns a single result.
Параметри
query-
за да го идентификувате кое поврзување сакате да го користите.
entireRow-
Стандардно, querySingle() returns the value of the first column returned by the query. If
entireRowistrue, then it returns an array of the entire first row.
Вратени вредности
Returns the value of the first column of results or an array of the entire first row (if entireRow is true).
If the query is valid but no results are returned, then null ќе се врати ако entireRow is false, otherwise an empty array is returned.
Invalid or failing queries will return false.
Примери
Пример #1 SQLite3::querySingle() example
<?php
$db = new SQLite3('mysqlitedb.db');
var_dump($db->querySingle('SELECT username FROM user WHERE userid=1'));
print_r($db->querySingle('SELECT username, email FROM user WHERE userid=1', true));
?>Горниот пример ќе прикаже нешто слично на:
string(5) "Scott"
Array
(
[username] => Scott
[email] => [email protected]
)