Rotating banner with hitcounter?!?
Posted: Wed Jun 11, 2008 3:09 am
I have made this rotating bannerscript wich works fine, but I am not able to collect hitstats. Where do I go wrong?
I can't see the error... Please help 
Code: Select all
$num_displayed = 1 ;
$result = mysql_query ("SELECT * FROM sponsor WHERE uid=".$uid." AND sponsor_b=1 ORDER BY RAND() LIMIT $num_displayed");
while ($sponsor_b = mysql_fetch_array($result))
{
$sponsor_b_id = $sponsor_b['sponsor_id'];
$sponsor_b_image = $sponsor_b['image'];
$sponsor_b_url = $sponsor_b['url'];
}
function dbIncClks($sponsor_b_id) {
$query="SELECT hits FROM sponsor WHERE(sponsor_id='$sponsor_b_id')";
If(num_rows() == 0) {
return false;
}
query("UPDATE sponsor SET hits=".(f('hits')+1)." WHERE(sponsor_id='$sponsor_b_id')");
}