From: Roland Häder Date: Fri, 30 Oct 2009 06:49:51 +0000 (+0000) Subject: SQL fix :( X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=455f56ecb794f44ca49b8beb511ce1ad24181398;p=mailer.git SQL fix :( --- diff --git a/inc/modules/member/what-payout.php b/inc/modules/member/what-payout.php index dbf4c50f2f..120c40a650 100644 --- a/inc/modules/member/what-payout.php +++ b/inc/modules/member/what-payout.php @@ -57,7 +57,7 @@ $result_depths = SQL_QUERY("SELECT level, percents FROM `{?_MYSQL_PREFIX?}_refde $totalPoints = 0; while ($content = SQL_FETCHARRAY($result_depths)) { // Load referal points - $result_points = SQL_QUERY_ESC("SELECT `points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_dept`h=%d LIMIT 1", + $result_points = SQL_QUERY_ESC("SELECT `points` FROM `{?_MYSQL_PREFIX?}_user_points` WHERE `userid`=%s AND `ref_depth`='%s' LIMIT 1", array(getUserId(), bigintval($content['level'])), __FILE__, __LINE__); // Entry found? @@ -97,12 +97,18 @@ ORDER BY type ASC", SQL_FREERESULT($result); // Check for his payouts - $result_payouts = SQL_QUERY_ESC("SELECT p.id, p.payout_total, p.target_account, p.target_bank, t.type, p.payout_timestamp, p.status, t.allow_url AS allow, p.target_url AS url, p.link_text AS alt, p.banner_url AS banner -FROM `{?_MYSQL_PREFIX?}_user_payouts` AS p -LEFT JOIN `{?_MYSQL_PREFIX?}_payout_types` AS t -ON p.payout_id = t.id -WHERE p.userid = %s -ORDER BY p.payout_timestamp DESC", + $result_payouts = SQL_QUERY_ESC("SELECT + p.id, p.payout_total, p.target_account, p.target_bank, t.type, p.payout_timestamp, p.status, t.allow_url AS allow, p.target_url AS url, p.link_text AS alt, p.banner_url AS banner +FROM + `{?_MYSQL_PREFIX?}_user_payouts` AS p +LEFT JOIN + `{?_MYSQL_PREFIX?}_payout_types` AS t +ON + p.payout_id = t.id +WHERE + p.userid = %s +ORDER BY + p.payout_timestamp DESC", array(getUserId()), __FILE__, __LINE__); if (SQL_NUMROWS($result_payouts) > 0) { // List all his requests @@ -163,7 +169,6 @@ ORDER BY p.payout_timestamp DESC", if (SQL_NUMROWS($result) == 1) { // ID is valid so load the data $content = SQL_FETCHARRAY($result); - SQL_FREERESULT($result); // Calculate maximum value $max = round($totalPoints * $content['rate'] - 0.5); @@ -272,6 +277,9 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')", // ID is invalid loadTemplate('admin_settings_saved', false, getMessage('PAYOUT_ID_INVALID')); } + + // Free result + SQL_FREERESULT($result); } // [EOF]