Hi,
This is the script that I am using for my redirection. I was wondering where I insert this line in order to update the "hits" field: mysql_query("UPDATE hits=hits+1 WHERE id=$id");
<?
$db_name = "yourdatabasename";
$table_name = "redirects";
$pathstring = getenv("HTTP_HOST") == "localhost" ? getenv("PATH_INFO") : $PHP_SELF ;
$id = $id;
$connection = mysql_connect("localhost", "yourdatabasename", "yourpassword")
or die("Couldn't connect.");
$db = mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$sql = "SELECT id, address FROM $table_name";
$sql .= " WHERE id = " . $id . ";";
$result = mysql_query($sql,$connection) or die("Couldn't execute query.");
while ($row = @mysql_fetch_array($result))
{
$id = $row["id"];
$address = $row["address"];
}
print "<HEAD>\n";
print "<SCRIPT language=\"JavaScript1.1\">\n";
print "<!--\n";
print "location.replace(\"".$address."\");\n";
print "file://-->\n";
print "</SCRIPT>\n";
print "<NOSCRIPT>\n";
print "<META http-equiv=\"Refresh\" content=\"0; URL=".$address."\">\n";
print "</NOSCRIPT>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "Click <A href=\"".$address."\">here</A> to continue.\n";
print "</BODY>\n";
print "\n";
?>
I tried it in a few different places but just couldn't get it to work.
Thanks,
Jen