Problem with recorset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all sorry for the newbie's question but i want understand the problem.
I have use a simple command with sqlite to get a data from a table.

$dbFile = realpath("./")."/data.db";

$db = sqlite_open($dbFile);

if (!(is_resource($db))) {
die("Impossibile aprire uno stream: ".
sqlite_error_string(sqlite_last_error($db)));
}


$query = "SELECT id, file, time FROM file";

$res = sqlite_unbuffered_query($db, $query);

while (list($id, $file, $time) = sqlite_fetch_array($res)) {
echo $id.$file.$time."\n";
} I i want use a OOP to get a data from a a table i get for every execution
of loop while the first record.


include("./classdb.php");

class DbData extends SqliteDbConnect
{
       function GetQueryResult($query)
       {
               $res = sqlite_unbuffered_query($this->dbLink, $query);
               return $rows = sqlite_fetch_array($res);
       }

}


$db =& new DbData("./", "data.db");

$query = "SELECT id, filem time FROM file";

while (list($id, $file, $time) = $db->GetQueryResult($query)) {
echo $id.$file.$time."\n"; }


I have tested the script with CLI on PHP4/Win.
Thanks so much to all.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux