I have an existing program in PHP. I just upgraded the
server from Debian 6 to 7. In the process, that upgraded php from 5.3.3
to 5.4.4. So far so good. But that means the old PHP interface to
sqlite went away. So I'm trying to update from the old PHP sqlite
interface to PDO.
PDO is not acting like I would expect, or like some of the
documentation indicates it should. The following code should return a
row count. It does not; it consistently returns 0 even when there are
multiple rows.
--------------------------------------------------
try {
($dbh = new PDO("sqlite:$dbPath"));
} catch (PDOException $exception) {
printf("Failed to connect to the database. Error: %s",
$exception->getMessage());
}
$query = "select rating, comment, categories from ratings where billType =
'$billType' and billNumber = '$billNumber'";
print ("<p>$query</p>\n");
$entry = $dbh->query($query);
print "\nRetrieved " . $entry->rowCount() . " row(s).\n";
--------------------------------------------------
The query, stuffed with the variable names, works correctly in the
sqlite3 command line tool.
Thanks
--
Charles Curley /"\ ASCII Ribbon Campaign
Looking for fine software \ / Respect for open standards
and/or writing? X No HTML/RTF in email
http://www.charlescurley.com / \ No M$ Word docs in email
Key fingerprint = CE5C 6645 A45A 64E4 94C0 809C FFF6 4C48 4ECD DFDB
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/