I recently upgraded my server from RHEL 4 to RHEL 5 and one of the
changes is the PHP interface to sqlite changed to be exclusively through
PHP's PDO functions.
I converted my databases to sqlite3 successfully but I'm having no end
of troubles getting my PHP scripts to be able to perform queries on the
databases.
I'm trying to keep this simple so for the sake to tracking down the problem.
The database is /home/greg/feedback.db and if I use the command line
tool I can do queries just fine:
[EMAIL PROTECTED] ~]$ cp ~gulikgroupnet/lib/sqlite/feedback.db .
[EMAIL PROTECTED] ~]$ sqlite3 feedback.db
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> select count(*) from feedback;
102
sqlite>
But if I try to do basically the same thing through a PHP script such as
this:
#! /usr/bin/php -q
<?
$dsn = 'sqlite:/home/greg/feedback.db';
try {
$handle = new PDO($dsn);
} catch (PDOException $e) {
echo 'Connction failed: ' . $e->getMessage();
die();
}
$sql = "SELECT count(*) FROM feedback";
$result = $handle->query($sql);
echo "rows = " . $result->rowCount() . "\n";
?>
I can run it but get no results:
[EMAIL PROTECTED] ~]$ ./test-sqlite
rows = 0
This one has been driving me nuts because I see no good reason why it
wouldn't work.
Any ideas?
--
Greg Gulik http://www.gulik.org/greg/
greg @ gulik.org
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------