I have got my website loggin user activity into a .txt file. I want to be able to show these results on my Admin area in separate pages. So page one shows 1-50 results and so on.
But the problem I have is it’s set out like this in the .txt file
User: Admin
IP Address: xx.xxx.xxx.xx
Host Address: xxxxxxxxxxxxxxxx
Date And Time: Monday 20th of September 2010 11:44:18 AM
URL: http://colemansystems.psm2.co.uk/
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.62 Safari/534.3
Refering URL:
With a gap of seven lines, between each set of information. I was thinking about putting it into a MySQL table but wouldn’t that get very big over time?
Any help is appreciated!
So what if it gets big? That’s what databases are for.
Let me assure you that the [one-time] cost of setting up a database and a table will be much less than maintaining a homebrew (as in custom-format) data file in the long run.
What if you want to know what happened between 2010-09-25 and -26 via the IP address 1.2.3.4? Are you going to write a function? (It’s a single statement in SQL.) Are you going to scan the whole file? (Proper DBMS’s will just use the indices. MySQL will use at least one index.)
I’m half inclined to say “try them both and see how the DB approach wins in the long run” because the advantages are too numerous to list.