topical media & game development

talk show tell print

server-php-sqlite-notes.php / php



  <?php
  
  host='localhost';
  database='local';
  username='root';
  password='hush';
  // create a SQLite3 database file with PDO and return a database handle (Object Oriented)
  try{
  
  //echo 'sqlite:'._SERVER['DOCUMENT_ROOT'].'/www/hush/sql/test.db';
  //dbHandle = new PDO('sqlite:'._SERVER['DOCUMENT_ROOT'].'/hush/sql/test.db');
  dbHandle = new PDO('sqlite:server-php-sqlite-notes.db');
  //dbHandle = new PDO('mysql:local','root','hush');
  //dsn = "mysql:host=host,dbname=database, username, password";
  //dbHandle = new PDO(dsn);
  
  }catch( PDOException exception ){
  
  die(exception->getMessage());
  
  }
  
  sqlGetView = 'SELECT * FROM notes';
  result = dbHandle->query(sqlGetView);
  // pageView = dbHandle->query(sqlGetView);
  pageView = result->fetch(); // store result in array
  
  // print page views
  echo pageView[1].'<br />';
  echo pageView[2].'<br />';
  echo pageView[3].'<br />';
  ?>
  


(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.