sqlite_seek.php : sqlite_seek « MySQL Database « PHP






sqlite_seek.php

 
<?php
   $sqldb = sqlite_open("mydatabase.db");
   $results = sqlite_query($sqldb, "SELECT empid, name FROM employee");

   $random = rand(0,sqlite_num_rows($results)-1);

   sqlite_seek($results, $random);

   list($empid, $name) = sqlite_current($results);
   echo "Randomly chosen employee of the month: $name (Employee ID: $empid)";
   sqlite_close($sqldb);
?>
  
  








Related examples in the same category

1.Using the sqlite_seek() Function