PHP Classes

File: counter.sql

Recommend this page to a friend!
  Classes of Richard Munroe   Access Pattern Counter   counter.sql   Download  
File: counter.sql
Role: Auxiliary data
Content type: text/plain
Description: Create MySQL tables
Class: Access Pattern Counter
Count page accesses and show the count in HTML
Author: By
Last change: Redesign using InnoDB tables.
Date: 19 years ago
Size: 790 bytes
 

Contents

Class file image Download
DROP DATABASE IF EXISTS counter ; CREATE DATABASE counter ; USE counter ; CREATE TABLE counter ( id int(11) NOT NULL auto_increment PRIMARY KEY, counter int(11) NOT NULL default '0', host varchar(255) default NULL, page longtext, timestamp datetime default NULL ) TYPE=InnoDB ; CREATE TABLE counterUser ( id int(11) NOT NULL auto_increment PRIMARY KEY, counterId int(11) default NULL, remoteAddr varchar(255) default NULL, timestamp timestamp(14) NOT NULL, repeat int(11) default '0', KEY counterId (counterId, remoteAddr), CONSTRAINT FOREIGN KEY (counterId) REFERENCES counter (id) ON DELETE CASCADE ) TYPE=InnoDB ; GRANT SELECT, INSERT, UPDATE, DELETE ON counter TO counter@localhost ; GRANT SELECT, INSERT, UPDATE, DELETE ON counterUser TO counter@localhost ;