I have a page action.php on which I run an SQL query through the code, so that whenever the page is viewed the query runs like its like counting page vi
action.php
If you just want to run it once for a user, I would set a session cookie and then use an if() statement.