|
Web Development & Graphic Design Problem Solving for Graphic Design, PHP, ASP, Perl, MySQL, SQL, XML, HTML issues |
![]() |
|
Topic Tools |
#1
|
|||
|
|||
Log File Generation in PHP
I'm drawing a blank here and I'd like a few suggestions if possible. I have a search script that searches through a list of articles stored in a database. What I would like to do is record a users search query and store it in a log file so I can display the last 20-40 searches in an admin panel, meaning i would need to both read and write from this log file.
I know how to read and write from the file, but I anticipate a lot of search queries, hundreds to thousands of them in a given day, and I'd like someway to control the size of the log file without having to manually delete it. Is there a way to automatically delete or purge the log file to make it smaller after 'x' number of searches? Or do you have any other recommendations to do this similar idea? Thanks for the help! Last edited by crashnet; July 18th, 2006 at 09:46 PM. |
#2
|
||||
|
||||
It would be best to store this in a database.
There are many ways you could manage the file. You could check the file size. Over a certain size then delete it. You could count the lines. You could read the first 200 lines then save them to a new log and delete the old. |
#3
|
|||
|
|||
Those are a bunch of great ideas. Thanks Degs. With your mention of storing them in a database, I'm beginning to think that may be a better idea. It would be easier to query the database for one, and easier to manage the table size.
Do you have any suggestions of what else would be beneficial to store in the database along with the search query? Thanks! Last edited by crashnet; July 19th, 2006 at 06:03 PM. |
#4
|
||||
|
||||
It would be alot more efficient and alot easier to query it.
It depends on how much info you want. URL, Date/Time, IP Address, Browser etc. |
![]() |
Bookmarks |
«
Previous Topic
|
Next Topic
»
Topic Tools | |
|
|
![]() |
||||
Topic | Topic Starter | Forum | Replies | Last Post |
The plusses of the now generation | Ned Seagoon | Open Discussion | 2 | April 22nd, 2018 09:17 AM |
Intel Processor 2nd Generation vs. 3rd Generation | Alexis_Anne | Hardware | 3 | June 19th, 2012 04:12 PM |
Next Generation Windows? | Triton46 | Open Discussion | 7 | July 26th, 2005 03:04 PM |
the younger generation... | Debz | Jokes Forum | 1 | December 11th, 2004 10:23 PM |
All times are GMT +1. The time now is 04:16 AM.