Php/docs/sqlite3.query

来自菜鸟教程
跳转至:导航、​搜索

SQLite3::query

(PHP 5 >= 5.3.0, PHP 7)

SQLite3::queryExecutes an SQL query


说明

public SQLite3::query ( string $query ) : SQLite3Result|false

Executes an SQL query, returning an SQLite3Result object. If the query does not yield a result (such as DML statements) the returned SQLite3Result object is not really usable. Use SQLite3::exec() for such queries instead.


参数

query
The SQL query to execute.


返回值

Returns an SQLite3Result object, 或者在失败时返回 false.


范例

Example #1 SQLite3::query() example

<?php$db = new SQLite3('mysqlitedb.db');$results = $db->query('SELECT bar FROM foo');while ($row = $results->fetchArray()) {    var_dump($row);}?>