I have an sqlite database with a config table with 3 rows: id, config and value.
I'd like to get the settings in this table in variables: how can I do that?
Here is a documentation how to use SQLite with PHP:
https://www.php.net/manual/en/book.sqlite.php
Edit: On the site you can see how it works
<?php
$dbhandle = sqlite_open('sqlitedb');
$query = sqlite_query($dbhandle, 'SELECT name, email FROM users LIMIT 25');
while ($entry = sqlite_fetch_array($query, SQLITE_ASSOC)) {
echo 'Name: ' . $entry['name'] . ' E-mail: ' . $entry['email'];
}
?>
$database['link'] = new SQLiteDatabase($database['uri']); $query = 'SELECT setting, value FROM config'; $result = $database['link']->arrayQuery($query); echo $result['name'] in example doesn't work. I don't know how to do that.$database['uri'] is where che sqlite database is located. When I try to print out $result['name'] I obtain... what? A few of minutes ago I obtained nothing. However, now I obtain turlandob, two values, but whithout any space. How can I divide and put them in variables?$query = 'SELECT setting, value FROM config'; //$result = $database['link']->arrayQuery($query); $result = $database['link']->unbufferedQuery($query); while ( $row = $result->fetch(SQLITE_ASSOC) ) { echo $row['name']; } I obtain Fatal error: Call to a member function fetch() on a non-object in /membri/turlando/site/includes/init.php on line 18. Line 18 is while ( $row = $result->fetch(SQLITE_ASSOC) ) {