From b17c72e5a671033c7079e43f28a43537e9f16ccf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 6 Sep 2008 20:48:57 +0000 Subject: [PATCH] Fix for PHP error --- inc/libs/surfbar_functions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index 1c676079a1..898b2a5d64 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -453,6 +453,12 @@ ORDER BY // 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')."
\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 @@ -463,7 +469,7 @@ LEFT JOIN "._MYSQL_PREFIX."_surfbar_salts AS sbs 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", -- 2.30.2