count how many times...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wesnoel
Forum Commoner
Posts: 58
Joined: Fri Sep 05, 2003 11:53 am

count how many times...

Post by wesnoel »

OK Basically I have a dir of csv files that are built each time a user submits a form. One of the form fields is named initials. What I would like to do is count how many times each user submitted the form on a daily , weekly, and monthly basis.

Basicly I want it to output like so:

WFN has submitted 16 time this month:

What would be the best way to do this?
Would I search through the entire dir and loop through each csv file?


Any hints or code sample or just a point in the right direction would help out a newbie.

TIA,

Wes/
wesnoel
Forum Commoner
Posts: 58
Joined: Fri Sep 05, 2003 11:53 am

Post by wesnoel »

OK I have searched and could not find anything like this.

Just a point in the right direction would be cool

Wes/
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

Check out php.net/filesystem . Make sure to look at readdir() , opendir() , and a method that best suits you for opening files ( fpassthru(), fopen(), file() ).

Once you are able to access the directory and read the required files into an array, you should then consider using something like explode() (based on , ) to break up the information into logical pieces so you can manipulate it.

Hope that helps a little.
Post Reply