gorilla1
01-17-2004, 09:38 PM
I have read in a file consisting of timestamp, pagevisitied and ip address, and I would like to display the contents ordered by ip address and ordered chronoligcally udner each ip address so that:
01.17.04 15:18:35 homepage xx.32.210.133
01.17.04 15:18:55 2ndpage xx.32.210.133
01.17.04 17:22:34 homepage xx.32.210.666
01.17.04 17:22:36 homepage xx.32.210.444
01.17.04 17:22:38 3rdpage xx.32.210.666
sorts to:
01.17.04 15:18:35 homepage xx.32.210.133
01.17.04 15:18:55 2ndpage xx.32.210.133
01.17.04 17:22:34 homepage xx.32.210.666
01.17.04 17:22:38 3rdpage xx.32.210.666
01.17.04 17:22:36 homepage xx.32.210.444
etc.
Below is how I read the file and create the array of each line...
$data = file("stuff.txt');
//
$data = array_reverse($data);
foreach($data as $key=>$element) {
$pieces = explode("|", $element);
I can't figure out how to set up a multidimensional arry with this and then sort on the two columsn, ip address and timestamp. Is there any way to do this without putting it in a database?
G
01.17.04 15:18:35 homepage xx.32.210.133
01.17.04 15:18:55 2ndpage xx.32.210.133
01.17.04 17:22:34 homepage xx.32.210.666
01.17.04 17:22:36 homepage xx.32.210.444
01.17.04 17:22:38 3rdpage xx.32.210.666
sorts to:
01.17.04 15:18:35 homepage xx.32.210.133
01.17.04 15:18:55 2ndpage xx.32.210.133
01.17.04 17:22:34 homepage xx.32.210.666
01.17.04 17:22:38 3rdpage xx.32.210.666
01.17.04 17:22:36 homepage xx.32.210.444
etc.
Below is how I read the file and create the array of each line...
$data = file("stuff.txt');
//
$data = array_reverse($data);
foreach($data as $key=>$element) {
$pieces = explode("|", $element);
I can't figure out how to set up a multidimensional arry with this and then sort on the two columsn, ip address and timestamp. Is there any way to do this without putting it in a database?
G