-
- /**
- * sqlite_fetch_array函数取结果集
- * by bbs.it-home.org
- */
- $sqldb = sqlite_open("mydatabase.db");
- $results = sqlite_query($sqldb, "SELECT * FROM employee");
- while ($row = sqlite_fetch_array($results,SQLITE_BOTH)) {
- echo "Name: $row[1] (Employee ID: ".$row['empid'].")
";
- }
- sqlite_close($sqldb);
- ?>
复制代码
例2,sqlite_fetch_array函数、list函数循环输出结果集
-
- /***
- * sqlite_fetch_array函数输出结果集
- * by bbs.it-home.org
- */
- $sqldb = sqlite_open("mydatabase.db");
- $results = sqlite_query($sqldb, "SELECT * FROM employee");
- while (list($empid, $name) = sqlite_fetch_array($results)) {
- echo "Name: $name (Employee ID: $empid)
";
- }
- sqlite_close($sqldb);
- ?>
复制代码
|