Help with changing price after deduction

Joined
Sep 17, 2021
Messages
4
Reaction score
0
This works successfully:


PHP:
$wallet = $user->wallet;
$upwallet = ($sell_video == 0 && $wallet >= 1 ? 0.5 : 0);
$db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet`- '".$upwallet."' WHERE `id` = '".$video->user_id."'");

(when the sell_video amount is 0 and the wallet amount >= 1, deduct .5 from the wallet). Works successfully.

I'd like guidance with adding after that code:
When the sell_video amount is 0 and the wallet amount = 0.5, change/update the sell_video to X.
Any assistance is welcomed.
 
Last edited:
Joined
Dec 16, 2022
Messages
5
Reaction score
3
To add the additional code you described, you can do the following:

PHP:
if ($sell_video == 0 && $wallet == 0.5) {
  $sell_video = X; // Replace X with the desired value for sell_video
  $db->rawQuery("UPDATE ".T_USERS." SET `sell_video` = '".$sell_video."' WHERE `id` = '".$video->user_id."'");
}

This code checks if the sell_video amount is 0 and the wallet amount is 0.5. If both conditions are true, it updates the sell_video value to the desired value (X) in the database.

I hope this helps! Let me know if you have any questions or need further clarification.
 
Joined
Mar 11, 2022
Messages
227
Reaction score
32
I do this for quite some time (actually since AOL beeep dialed in), but i have no clue what you guys are taling about.

What class is $user attached to? What am i missing?
Please don't let me die dull.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top