Problem with recorset
| From: | kioto | Date: | Wed, 13 Apr 2005 07:26:51 +0000 |
| Subject: | Problem with recorset | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-212990@lists.php.net to get a copy of this message | ||
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.