Jump to content
MakeWebGames

Recommended Posts

Posted

i wish to make my bank intrest only go up via being active, i currently have a working sytem, when you login it redirects you to the logged in page which sets you as active and at the end of each day the day cron sets you back to inactive. altho i cannot work out how to get the bank intrest to only go up in the crons when you are active that day can anyone please help with this?

here is the piece of code i wish to only work if active= 1 but im unsure if i can repeat the where command or not :p

 

$db->query("UPDATE users SET bankmoney=(bankmoney*1.003) where bankmoney>0");

 

any help would be GREATLY appreaciated ty

Posted

One way of doing it is checking to see if the person was active. So if you wanted only the people who have been on in the day to get bank interest then you find i believe it is laston in the users table and check to see if their laston was less than 24 hours. I am not the best at programming but I would think something along the lines of this code would work, but could be 100% wrong. haha

$lastactive = time() - (60*60*24);

if($ir['laston'] > $lastactive) {

$bankinterest = 1.003;

} else {

$bankinterest = 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...