Hello,
I can't figure out why PHP isn't happy with the following query:
==============
<?php
$dir = 'sqlite:mydb.sqlite';
$dbh = new PDO($dir) or die("cannot open the database");
//INSERT OK
$today = date("Y-m-d H:i:s");
$query = $dbh->prepare('INSERT INTO mytable (date, home_id, mode_id) VALUES
(?, ?, ?)');
$query->execute(array($today,$home, $mode));
//CREATE TABLE mode (mode_id INTEGER, mode_txt TEXT);
//SELECT OK
//$query = $dbh->prepare("SELECT mode_txt FROM mode WHERE mode_id=0 LIMIT
1");
//NOK !
$query = $dbh->prepare("SELECT mode_txt FROM mode WHERE mode_id=? LIMIT 1");
$result=$query->execute(array($mode));
if ($result) {
//! Fatal error: Call to a member function fetch() on boolean in
blah.php
$mode = $result->fetch(PDO::FETCH_COLUMN);
}
$dbh = null;
?>
==============
Is it due to some incompatibility between SQLite's INTEGER and PDO?
Thank you.
--
Sent from: http://sqlite.1065341.n5.nabble.com/
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users