Jump to content
MakeWebGames

Recommended Posts

Posted

I want to set up my Donator Bank to interest users based upon ones donationdays and vipdays. Players who have just ddays and no vip will max at 2% along with only a 500m max interest and vip will be double if they have both vip and ddays then it should be maxed at 6% and maxed interest is 1.5b??

ie. users with 1 donator days get .05 percent interest/vip gain .1 interest per vip day

Posted
UPDATE `users`
SET `bankmoney` = LEAST (`bankmoney`+ (`bankmoney` / 100) * 0.2, 500000000)
WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vip_days` <= 0)

UPDATE `users`
SET `bankmoney` = LEAST ( `bankmoney`+(`bankmoney` / 100) * 0.6, 1500000000)
WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vip_days` > 0)

 

I believe that should work. Untested.

  • Like 2
Posted (edited)

QUERY ERROR: FUNCTION ****_****.LEAST does not exist

heres what im using for the code....

$db->query("UPDATE `users` SET `donatormoney` = LEAST (`donatormoney`+ (`donatormoney` / 100) * 0.2, 500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` <= 0)");
$db->query("UPDATE `users` SET `donatormoney` = LEAST ( `donatormoney`+(`donatormoney` / 100) * 0.6, 1500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` > 0)");
Edited by AnonymousUser
Posted
QUERY ERROR: FUNCTION ****_****.LEAST does not exist

heres what im using for the code....

$db->query("UPDATE `users` SET `donatormoney` = LEAST (`donatormoney`+ (`donatormoney` / 100) * 0.2, 500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` <= 0)");
$db->query("UPDATE `users` SET `donatormoney` = LEAST ( `donatormoney`+(`donatormoney` / 100) * 0.6, 1500000000) WHERE (`bankmoney` > 0) AND (`donatordays` > 0) AND (`vipdays` > 0)");

What version of MYSQL are you running?

Posted
UPDATE `users` SET `bankmoney` = IF(`vip_days` <= 0, LEAST(`bankmoney` + (`bankmoney` / 100) * 0.2, 500000000), LEAST(`bankmoney` + (`bankmoney` / 100) * 0.6, 500000000)) WHERE `bankmoney` AND `donatordays`;

 

If any error, post it up.

Posted
actually that worked haunted! lol thanks a bunch... +1 for u and +1 for sniko for trying :) thanks again guys now i just gotta add to my donatorbank to say how much interest they're getting :p

Ah good to hear!

Posted

but it looks like its updating the users donator bank to where if they have 'max interest' its setting there total bank amount to the max interest instead of giving it to them lol

 

$db->query(" UPDATE `users` SET `donatormoney` = IF(`vipdays` <= 0, LEAST(`donatormoney` + (`donatormoney` / 100) * 0.2, 500000000), LEAST(`donatormoney` + (`donatormoney` / 100) * 0.6, 500000000)) WHERE `donatormoney` AND `donatordays`");
Posted
but it looks like its updating the users donator bank to where if they have 'max interest' its setting there total bank amount to the max interest instead of giving it to them lol

$db->query(" UPDATE `users` SET `donatormoney` = IF(`vipdays` <= 0, LEAST(`donatormoney` + (`donatormoney` / 100) * 0.2, 500000000), LEAST(`donatormoney` + (`donatormoney` / 100) * 0.6, 500000000)) WHERE `donatormoney` AND `donatordays`");

$db->query("UPDATE `users` SET `donatormoney` = `donatormoney` + IF(`vipdays` <= 0, LEAST(`donatormoney` + (`donatormoney` / 100) * 0.2, 500000000), LEAST(`donatormoney` + (`donatormoney` / 100) * 0.6, 500000000)) WHERE `donatormoney` AND `donatordays`"); 

Forgive spelling errors for column names.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...