Hey all. I'm using directory iterator to show the last time a file is accessed. How can i make a counter that counts everytime the file is accessed and stores it somewhere?
Store it a database. And each time someone access the file have the code grab the last amount in the database and +1 to it. and resubmitted it to the database.
I was thinking that too, but as a newbie I have no idea how to write that code. Can you get me started :queasy:
Alright, I managed to insert the file names into a database:
$count = $file->getFilename(); mysql_query("INSERT INTO mp3 VALUES ('$count')");
but it inserts the data everytime i refresh the page and also inserts "." and ".." How can i avoid these?
select the file state from the database, then update its counter value or insert it if its missing.
." and "..
use the IF condition to know if the file name is "." or a ".."