topical media & game development

talk show tell print

server-php-sqlite-demo-object.php / php

  // create new database (OO interface)
  db = new SQLiteDatabase("server-php-sqlite-demo.db");
  // create table foo and insert sample data
          CREATE TABLE foo(id INTEGER PRIMARY KEY, name CHAR(255));
          INSERT INTO foo (name) VALUES('Ilia');
          INSERT INTO foo (name) VALUES('Ilia2');
          INSERT INTO foo (name) VALUES('Ilia3');
  // execute a query    
  result = db->query("SELECT * FROM foo");
  // iterate through the retrieved rows
  while (result->valid()) {
      // fetch current row
      row = result->current();     
  // proceed to next row
  // not generally needed as PHP will destroy the connection

(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.