Jump to content

[SOLVED] Help with cronjob


Khashul

Recommended Posts

I'm currently making a game and for some reason can't get the crons right.

 

I'm sure its just something stupid I'm doing and cant see it because i've been sat infront of code for the last few days solidly.

 

The problem is that in a members bank they should gain interest on the amount each time the cron is run. I have set the interest at 3% but cant get it to update each member with money in the bank.

 

<?php

session_start();
include("../config.php");

$bankinterest = 0.3;

$bankqry = mysql_query("SELECT * FROM members WHERE bank > 0");

while ($member = mysql_fetch_assoc($bankqry)) {

$memberid = $member['id'];
$bankgain = (floor(100 * ($bankinterest / $member['bank']))) + $member['bank'];

mysql_query("UPDATE members SET bank = $bankgain WHERE id = $memberid");
}

?>

 

If anyone can help I would much appreciate that :)

 

Martin

Link to comment
https://forums.phpfreaks.com/topic/135009-solved-help-with-cronjob/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.