PHP/MySQL Database/sqlite current — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 10:37, 26 мая 2010
Using sqlite_current() and sqlite_next()
<?php
function my_sqlite_fetch_array($result,$type = SQLITE_BOTH,$decode = true) {
if(!sqlite_next($result)) {
return false;
} else {
return sqlite_current($result, $type, $decode);
}
}
$sqlite = sqlite_open(":memory:");
sqlite_query($sqlite, "CREATE TABLE test(value INTEGER PRIMARY KEY)");
for($count = 0; $count < 5; $count++) {
sqlite_unbuffered_query($sqlite, "INSERT INTO test VALUES(NULL)");
}
$result = sqlite_query($sqlite, "SELECT * FROM test");
while($row = my_sqlite_fetch_array($result)) {
var_dump($row);
}
?>