Here is the code:
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
if ($_GET['id']) {
$id = $_GET['id'];
$db = new SQLite3('database.db');
$sth = $db->query('SELECT * FROM channels WHERE id = :id');
$sth->bindValue(':id', $id);
while ($row = $sth->fetchArray()) {
var_dump($row);
}
}
?>
Here is the error message:
Fatal error: Call to undefined method SQLite3Result::bindValue() in /var/www/index.html on line 12
I do not understand what Call to undefined method means since I am following the examples on PHP's own website.
$db->prepare(), not$db->query().queryreturns a result set;preparereturns a statement.