I have tried this
(database table is called Hits with 2 columns AffiliateID and Counter)
<?php require_once('Connections/mainconnect.php'); ?>
<?php
if (!@session_id()) {
session_start();
$AffiliateID = $_GET["AffiliateID"];
mysql_select_db($database_mainconnect, $mainconnect);
mysql_query("UPDATE Hits SET Counter = Counter+1 WHERE AffiliateID=$AffiliateID;");
header('Location: ' . $AffiliateID);
} else {
header('Location: '.$AffiliateID);
}
mssql_close($con);
?>
However when I load the page it automatically returns me to my homepage - I don't have any page access restricts on it.