\n"; $mysqldb->query($query); $row = $mysqldb->fetchObject(); $username = $row->owner; $adsAllowed = $row->adsAllowed; // check for number of ads allowed active $query = sprintf("select adsAllowed from users where username = '%s'",$username); echo "\n"; $mysqldb->query($query); $row = $mysqldb->fetchObject(); $adsAllowed = $row->adsAllowed; // number of currently active ads $query = sprintf("select count(*) as ads from listings where active='yes' and owner = '%s'",$username); echo "\n"; $mysqldb->query($query); $row = $mysqldb->fetchObject(); $adsCurrent = $row->ads; if(($adsCurrent +1) > $adsAllowed) { $active="no"; // put out message stating they have reached their limit!!! printf("You are past your allowed limit for ads, you are allowed %s, and have %s. Please upgrade on User Screen", $adsAllowed,$adsCurrent); } else { $query = sprintf("update listings set active='yes', expiryDate = CURDATE(), noticeSent='no' where id=%s",$_GET['id']); $mysqldb->query($query); printf("Ad reactivated"); } ?>