note 99917 modified in sqlite3result.fetcharray by danbrown

From: Date: Wed, 15 Sep 2010 15:22:05 +0000
Subject: note 99917 modified in sqlite3result.fetcharray by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-172577@lists.php.net to get a copy of this message
To loop through a record set: <?php $db = new SQLite3('auth.sqlite'); $sql = "SELECT user_id, username, opt_status FROM tbl_user"; $result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC); $row = array(); $i = 0; while($res = $result->fetchArray(SQLITE3_ASSOC)){ if(!isset($res['user_id'])) continue; $row[$i]['user_id'] = $res['user_id']; $row[$i]['username'] = $res['username']; $row[$i]['opt_status'] = $res['opt_status']; $i++; } print_r($row); ?> --was-- To loop through a record set: $db = new SQLite3('auth.sqlite'); $sql = "SELECT user_id, username, opt_status FROM tbl_user"; $result = $db->query($sql);//->fetchArray(SQLITE3_ASSOC); $row = array(); $i = 0; while($res = $result->fetchArray(SQLITE3_ASSOC)){ if(!isset($res['user_id'])) continue; $row[$i]['user_id'] = $res['user_id']; $row[$i]['username'] = $res['username']; $row[$i]['opt_status'] = $res['opt_status']; $i++; } print_r($row); http://php.net/manual/en/sqlite3result.fetcharray.php

« previous php.notes (#172577) next »