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!
On the beginning of my index.php file, i inserted the following code to track the visitors who visit my website. But obviously, anytime when they return to the index page, the following code makes a recurring record. So how may i avoid this recurring recording each time when the visitor returns to the index page?
Thanks for the attention. I am okay with handling matters regarding database issues but i am totally a newbie on those kind of subject.
Would you be more specific and if possible by providing an example
session_start();
if (!isset($_SESSION['userflag'])) {
mysql_query(...) or die(mysql_error());
$_SESSION['userflag'] = true;
}
When the page is loaded for the first time the $_SESSION['userflag'] won't exist, which will allow you to execute any code that only should be run once.