Go Back   Cyber Tech Help Support Forums > Software > Web Development & Graphic Design

Notices

Web Development & Graphic Design Problem Solving for Graphic Design, PHP, ASP, Perl, MySQL, SQL, XML, HTML issues

Reply
 
Topic Tools
  #1  
Old July 18th, 2006, 09:40 PM
crashnet crashnet is offline
Member
 
Join Date: May 2004
Posts: 45
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.
Reply With Quote
  #2  
Old July 19th, 2006, 10:25 AM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,475
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.
Reply With Quote
  #3  
Old July 19th, 2006, 05:58 PM
crashnet crashnet is offline
Member
 
Join Date: May 2004
Posts: 45
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.
Reply With Quote
  #4  
Old July 19th, 2006, 06:23 PM
degsy's Avatar
degsy degsy is offline
Cyber Tech Help Moderator
 
Join Date: Jul 2001
Location: North-East, UK
Posts: 22,475
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.
Reply With Quote
Reply

Bookmarks

Topic Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
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.