// Free result
SQL_FREERESULT($result);
+ // Shall we add some ids?
+ $ADD = "";
+ if (count($USE) > 0) {
+ $ADD = " AND l.id IN (".implode(",", $USE).")";
+ } // END - if
+
// And query the database
//* DEBUG: */ echo __FUNCTION__.":randNum={$randNum},maxRand={$maxRand},surfLock=".SURFBAR_GET_DATA('surf_lock')."<br />\n";
$result = SQL_QUERY_ESC("SELECT sbu.id, sbu.userid, sbu.url, sbs.last_salt, sbu.reward, sbu.costs, sbu.views_total, p.time, UNIX_TIMESTAMP(l.last_surfed) AS last_surfed
ON sbu.id=sbs.url_id
LEFT JOIN "._MYSQL_PREFIX."_surfbar_locks AS l
ON sbu.id=l.url_id
-WHERE sbu.userid != %s AND sbu.status='CONFIRMED' AND l.id IN (".implode(",", $USE).")
+WHERE sbu.userid != %s AND sbu.status='CONFIRMED'".$ADD."
GROUP BY sbu.id
ORDER BY l.last_surfed ASC, sbu.id ASC
LIMIT %s,1",