Help with statement and query


    $wallet = $user->wallet;

        if ($sell_video == 0 && $wallet >= 1) {
        $db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet` - '0.5' WHERE `id` = '".$video->user_id."'");
}

I’ve tried this, but no success. Success would be (upon a transaction) when sell_video is 0 and the wallet is >= 1 then deduct 0.5 from the wallet.

Any guidance with this is greatly appreciated.

Try this (not tested):

$wallet = $user->wallet;

if ($sell_video == 0 && $wallet >= 1) {
    $db->rawQuery("UPDATE ".T_USERS." SET `wallet` = " . $wallet - 0.5 . " WHERE `id` = '".$video->user_id."'");
}
Sponsor our Newsletter | Privacy Policy | Terms of Service