I am trying to develop a script for rotating banners and I want to keep track of the amount of clicks that the banner has. To do this I put the following code into the onclick event on a banner after it chooses the rotating image
<?php include('sqlconnect.php'); $add1c=1+$data1['clicks']; //click $add1d=1+$data1['totalclicks']; //total if($add1c>=$limit1){ mysql_query("UPDATE banners Set rotating=0 Where banner_id='".$data1['banner_id']."'"); //turns off banner for day } mysql_query("UPDATE banners Set clicks=".$add1c." Where banner_id='".$data1['banner_id']."'"); //banner for click mysql_query("UPDATE banners Set totalclicks=".$add1d." Where banner_id='".$data1['banner_id']."'"); //totalclicks include('sqlcloseit.php'); ?>Earlier I included a file where the $data1 was a sql query and I know that works because every time I refresh the page it counts it as a click because im guessing its executing the php when the page starts up. I know thats what php does but my question is how do people keep track of clicks in a sql database for a click when php only occurs when the page originally starts up?