well i got it so that it gives the count to the clicks field, but i cant get it to go to the bannerurl, which is to the place where a person will go if clicked on. Any help ? Please !!
Here is what i did.. I added
banner.php?bannerurl=<?echo $bannerurl;?>&id=<?echo $id;?>
to the below code, now when clicked on it brings them to the banner.php page.
$sql = mysql_query ("SELECT * FROM banners ORDER BY RAND() LIMIT 1");
while ($myrow = mysql_fetch_array($sql)) {
$id=$myrow["id"];
$banner=$myrow["banner"];
$bannerurl=$myrow["bannerurl"];
?>
<a href="banner.php?bannerurl=<?echo $bannerurl;?>&id=<?echo $id;?>"><img border="0" src="<?echo $ROOT_HOST;?>images/<?echo $banner;?>" width="468" height="60"></a>
<?
$sql2 = mysql_query("UPDATE banners SET numviews = numviews + 1 where id=$id");
mysql_query($sql2);
}
?>
Now on the banner.php page i put this code, but it doesnt redirect them to it..
$sql = mysql_query("SELECT id,banner,bannerurl,clicks FROM banners WHERE id='$id'");
$row = mysql_fetch_array($sql);
$sql2 = mysql_query("UPDATE banners SET clicks = clicks + 1 where id=$id");
mysql_query($sql2);{
header("Location: $bannerurl");
}
mysql_close();