|
Posted by Kioto on 10/19/11 11:13
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.
Navigation:
[Reply to this message]
|