SourceForge.net Logo

Home- Data Collection- Data Mining- GPL Software- Services- FAQ- Tips

Event Counting


Daily Total = 11
12:00AM 0
8:00AM
8:00AM 7
4:00PM
4:00PM 4
12:00PM

In this script we rely heavily on MySQL. The structured query language allows us to specify what events we would like to count and MySQL simply passes back the number of records that match our criteria. The rest is mostly formatting.

Add some records to demonstrate use
mysql -p
*password*
use data
delete from data_bit where ts < 19900102000000 and ts > 19900101000000 and station = 0;
insert into data_bit values (19900101080000,0,0,1);
insert into data_bit values (19900101080100,0,0,1);
insert into data_bit values (19900101080130,0,0,1);
insert into data_bit values (19900101080200,0,0,1);
insert into data_bit values (19900101100300,0,0,1);
insert into data_bit values (19900101110400,0,0,1);
insert into data_bit values (19900101121000,0,0,1);
insert into data_bit values (19900101161500,0,0,1);
insert into data_bit values (19900101172000,0,0,1);
insert into data_bit values (19900101182040,0,0,1);
insert into data_bit values (19900101182120,0,0,1);
quit

Place the script in the /home/data/www/ directory on the server.
count.php Source Code

Call the script like this
count.php?edate=1990-01-01&element=0&station=0&value=1


Home- Data Collection- Data Mining- GPL Software- Services- FAQ- Tips

SourceForge.net Logo

http://sourceforge.net/projects/frontiertech/