Using sqlite_current() and sqlite_next() : sqlite_current « MySQL Database « PHP






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);

    }

?>
  
  








Related examples in the same category