On Sun, 19 May 2013 22:14:07 -0600
Steve Meyers <[email protected]> wrote:

> According to this page:
> http://us3.php.net/manual/en/pdostatement.rowcount.php
> 
> Returning a row count for a SELECT statement is not consistently 
> implemented across database drivers, and should not be depended upon. 
> The method is meant to return a count of rows affected by an UPDATE, 
> INSERT, or DELETE statement.

Thanks. Apparently sqlite3 is one of those culprits. The following
seems to work:

--------------------------------------------------
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' and user = '$usernames[$user]'";
print ("<p>$query</p>\n");

$entry = $dbh->query($query);

$entry->setFetchMode(PDO::FETCH_ASSOC);

if ($row = $entry->fetch()) {

    print "Bill found!\n";

    print_r ($row);

} else {

    print "No Bill!\n";

}
--------------------------------------------------


-- 

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.
*/

Reply via email to