i think with this function users can add some amount to their account but what i would like to do is each day user login i want to add the some amount automatically.
each day user login to the site i want to add 1000coins amount to their account
and if only possible
each login i also want user to get 10 coins
function addAmountcoins($member_id, $change_amount_coins) {
$ret = false;
$exists_arr = $this->isBalanceExists($member_id);
if($exists_arr["status"] == true) {
if($exists_arr["results"]["exists"] == true) {
$q = "UPDATE balance SET amount_coins=amount_coins+$change_amount_coins, record_date=NOW() WHERE member_id='$member_id' LIMIT 1";
} else {
$q = "INSERT INTO balance(member_id, amount_coins,record_date) VALUES($member_id,$change_amount_coins,NOW())";
}
//echo $q;
$rs = $this->db->query($q);
if($rs) {
$this->amount_coins += $change_amount_coins;
$sql = "insert into balance_change (`id`, `member_id`, `direction`, `change_amount_coins`, `balance_amount_coins`, `record_date`, `transaction_type_code`) values('', $member_id, '+', $change_amount_coins, $this->amount_coins, now(), 'CI' )";
$query=mysql_query($sql);
$ret = true;
}
}
return $ret;
}