I have a traffic exchange site and I have a small problem on the surfing area .
Normally the script should choose only sites that have credits but it does not .
I search on google and here also but I couldn’t find my answere .
$hour = date('Y-m-d:H');
$res = mysql_query("update site set hour='$hour', cth=0 where hour!='$hour' && cph!=0");
$query = "select id, url from site where usrid!=".$_SESSION['sess_data']['usrid']." && state='Enabled'";
if ($_SESSION['sess_data']['negact'] == 0) {
$query = $query." && credits>=1";
}
$query = $query." && (cth<cph || cph=0)";
$query = $query." order by rand() limit 1";
$res = mysql_query($query);
if (mysql_num_rows($res) == 0) {
$url = $default_site;
$siteid = 0;
} else {
$url = mysql_result($res, 0, "url");
$siteid = mysql_result($res, 0, "id");
}
If I’m right this is the part where the script get’s the websites .
$query = "select id, url from site where usrid!=" . $_SESSION['sess_data']['usrid'] . " && state='Enabled'";
In this line I would like to add a limit , to choose sites that have +5 credits. ( Again , If I’m right )
Thanks .
USE “
WHERE credits > 5” or whatever your “credits” column is called.