server-php-sqlite-count.php / php
<?php // create a SQLite3 database file with PDO and return a database handle (Object Oriented) try{ //echo 'sqlite:'. //dbHandle = new PDO('sqlite:'. dbHandle = new PDO('sqlite:server-php-sqlite-count.db'); }catch( PDOException exception->getMessage()); } // create page view database table dbHandle->exec(// remove or 'comment out' this line after first run // insert page visit in database with a prepared statement sqlInsertVisit = 'INSERT INTO pageView (page, access) VALUES (:page, :access)'; dbHandle->prepare(stmt->bindParam(':page', stmt->bindParam(':access', time(), PDO::PARAM_INT); // get page views from database pageVisit = _SERVER['PHP_SELF']); pageVisit.''; dbHandle->query(pageView = // store result in array // print page views echo pageVisit.' page has been viewed '.
(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.