PHP/MySQL Database/sqlite fetch array

Материал из Web эксперт
Перейти к: навигация, поиск

sqlite_fetch_array-2.php

 
<?php
   $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)<br />";
   }
   sqlite_close($sqldb);
?>



sqlite_fetch_array.php

 
<?php
   $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"].")<br />";
   }
   sqlite_close($sqldb);
?>