MySql查询更新不起作用

时间:2018-02-28 15:07:07

标签: php mysql

我有一个PTC网站,用户可以通过点击广告和推荐人来赚取收入。问题在于推荐人。会员报告说,如果他们点击,他们就无法从推荐中获利。

这是在成员观看ands后执行的查询:

if ($user_info['ref1'] != 0 && $checkadcat == 1) {
                $refclass = new RefCron($user_info['ref1']);
                $ref = $refclass->get_info();

                if (($settings['clicks_necessary'] <= $refclass->yesterdayclicks() && $settings['click_yesterday'] == "yes") || $settings['click_yesterday'] != "yes") {
                    $ref_type = $db->fetchRow("SELECT id, ref_click FROM membership WHERE id=" . $ref['type']);
                    $refmoney = $ad_info['value'] * $ref_type['ref_click'] / 100;
                    $set = array("money" => $ref['money'] + $refmoney, "refearnings" => $ref['refearnings'] + $refmoney, "refclicks" => $ref['refclicks'] + 1, $refclicks[$refclass->get_chartnum()] => $ref[$refclicks[$refclass->get_chartnum()]] + 1);
                    $upd = $db->update("members", $set, "id = " . $ref['id']);
                    $upd = $db->query("UPDATE members SET for_refclicks=for_refclicks+1, for_refearned=for_refearned+" . $refmoney . ", for_reflastclick=" . TIMENOW . (" WHERE id=" . $user_info['id']));
                }

                unset($ref);
            }


            if ($user_info['rented'] != 0 && $checkadcat == 1) {
                $refclass = new RefCron($user_info['rented']);
                $ref = $refclass->get_info();

                if (($settings['clicks_necessary'] <= $refclass->yesterdayclicks() && $settings['click_yesterday'] == "yes") || $settings['click_yesterday'] != "yes") {
                    $ref_type = $db->fetchRow("SELECT * FROM membership WHERE id=" . $ref['type']);
                    $refmoney = $ad_info['value'] * $ref_type['ref_click'] / 100;
                    $set = array("money" => $ref['money'] + $refmoney, "refearnings" => $ref['refearnings'] + $refmoney, "refclicks" => $ref['refclicks'] + 1, $rentedrefclicks[$refclass->get_chartnum()] => $ref[$rentedrefclicks[$refclass->get_chartnum()]] + 1);

示例:用户A已被用户B推荐,因此用户B每次观看广告时都应从用户A获得收益,但这并不起作用。甚至db行也不会更新..

出了什么问题?

0 个答案:

没有答案