Im starting to use sqlite3 but I’am unable to get some results. My database is called database.sqlite3
Inside SQLite command prompt and doing ‘SELECT * FROM table’; . works fine. But im having problems with php.
$db = new SQLite3('db/database.sqlite3'); $result = $db->query('SELECT * FROM table'); var_dump( $result );
The result of this code is : object(SQLite3Result)#3 (0) { }
What is worng here?
Thank you.
PD: $result->fetchArray(SQLITE3_ASSOC) works but only gives me one record… why???
Advertisement
Answer
from the php doc, the return value of query
:
Return Values
Returns an SQLite3Result object, or FALSE on failure.
Have a look at the fetcharray
method of the Result object to see how to get (fetch) the the row data.