Jump to content
MakeWebGames

Donator Bank Interest Question


Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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`");
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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...