The following code is intended to look in my database to see if there is a matching ipaddress and if there is, set action=1 in the records' action field. But instead, I just get a blank screen, no redirect and no action=1.. If I eliminate the database code section, it redirects. What is wrong with my code?
<?php
$ipaddress=$_SERVER['REMOTE_ADDR']
$db1=mysql_connect("localhost","user","pw");
mysql_select_db("affiliatelog",$db1);
$query1="UPDATE visitor_log SET action = '1' WHERE ipaddress='$ipaddress'";
mysql_query($query1) or die('Database Query Error: '.mysql_error());
mysql_close($db1)
$sub=$_GET['sub'];
$offer=$_GET['offer'];
if ($offer == "xxx") {$product = "http://site1.com?sub=$sub";} // Default link
if ($offer == "bbb") {$product = "http://site2.com/?sub=$sub";} // Default link
if(!empty($product)) {echo '<script type="text/javascript">'."window.location.replace('".$product."');</script>";}
exit();
?>