PHP PDO error using SQLite3 -
here 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 * channels id = :id'); $sth->bindvalue(':id', $id); while ($row = $sth->fetcharray()) { var_dump($row); } } ?>
here error message:
fatal error: call undefined method sqlite3result::bindvalue() in /var/www/index.html on line 12
i not understand call undefined method
means since following examples on php's own website.
prepare()
where that? if following manual correctly preparing statement , statement provide bindvalue()
method :)
by executing query directly on database handle don't features statements provide. have create sqlite3stmt
object it.
like this
$stmt = $db->prepare('select * channels id=:id'); $stmt->bindvalue(':id', $id, sqlite3_integer); $result = $stmt->execute();
Comments
Post a Comment