What I’m trying to accomplish, is that every time an amount gets updated to the uploaders ‘balance’ column, half that amount gets updated(added to) into the uploaders ‘money’ column. However, using the code below, when the amount ‘3’ is added to the ‘balance’ column, just ‘1’ gets added to the ‘money’ column, instead of the intended amount of 1.5. And both columns have the same table structure:
$up_amount = $video_cost_new *0.50; // add to the balance $uploader_account = $up_user_start->balance+$up_amount; $money_amount = $up_amount / 2; $up_user_start = $db->where('id', $video->user_id)->getOne(T_USERS); $money_account = $up_user_start->money+$money_amount; $db->where('id', $video->user_id); $update_money = $db->update(T_USERS, [ 'money' => number_format($money_account, 1, '.', ''), ]);
Can you suggest what I can change to get it correct? You guidance is appreciated.