hey everyone I need help with this script. I can't get it to work. first I will explain what it is supposed to do.
I have this php file named track.php. It is supposed to count the number of times a link has been clicked. lets say i have a url. instead of it being www.domain.com it is http://www.yoursite.com/track.php?url=www.domain.com
so it runs through the track.php file and is supposed to update the database and automatically forward you to the correct url (which would be www.domain.com as used above)
But it isn't updating my database nor is it forwarding me to the specified url.
Any help would be greatly appreciated. Thanks
Here is the php code below
<?
mysql_pconnect("localhost","username","password");
mysql_select_db("databaseName");
$result = mysql_query("select * from table WHERE url='$url'");
while($r=mysql_fetch_array($result))
{
$id=$r["id"];
$count=$r["count"];
$url=$r["url"];
$count++;
$update = "UPDATE table SET count='$count' WHERE id=$id";
$updatesql = mysql_query($update);
?>
<script language="JavaScript">
document.location.href="<?php echo $url;?>"
</script>
<? } ?>