Sokeybuster Posted February 27, 2011 Posted February 27, 2011 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 Quote
Equinox Posted February 27, 2011 Posted February 27, 2011 $db->query("UPDATE users SET bankmoney=(bankmoney*1.003) where bankmoney>0 AND active = 1"); Quote
W3Theory || Peter Posted February 27, 2011 Posted February 27, 2011 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; } Quote
W3Theory || Peter Posted February 27, 2011 Posted February 27, 2011 Ahh yeah that works :P , didn't see the whole active=1 thing :P Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.