I am looking to create a site where a session lasts 30 minutes. There is a session table that is updated with a list of new sessions. I have the following thing coded. But I noticed that there are over 213 sessions created although the test-site only had 23 pageviews from 10 visits or so (which means 10 sessions at the maximum). Could you please tell me where I am going wrong that there were over 213 sessions created in one day?
$result=mysql_query("SELECT * FROM $database_name.sessiontable_name WHERE id='".session_id()."';",$databaseconnect);
$row = mysql_fetch_array($result);
$q="INSERT INTO $database_name.sessiontable_name (id, timesession) VALUES (\"$id\", $t);";
mysql_query("UPDATE $database_name.sessiontable_name SET timesession=$t WHERE id=\"$id\";");