[eluser]The Revel[/eluser]
I am getting the following error:
Code:
A PHP Error was encountered
Severity: Notice
Message: Object of class stdClass could not be converted to int
Filename: controllers/auth.php
Line Number: 951
Here is my codeing:
Code:
//Update Balance
$query = $this->db->select('balance')
->from('users')
->where('scancode', $scancode)
->get();
if ($query->num_rows() > 0)
{
$balance = $query->row();
}
//Add a single total transaction to the Transactions List
$full_tr = array('store_id' => $store_id,
'scan_id' => $scancode,
'amount' => $total,
'date' => $date,
'admin' => $this->input->post('admin'),
);
$this->db->insert('transactions', $full_tr);
$new_balance = $balance + $total;
$update_balance = array(
'balance' => $new_balance
);
$this->db->where('scancode', $scancode);
$this->db->update('users', $update_balance);
Line 951 pertains to:
Code:
$new_balance = $balance + $total;
The odd thing is, its doing all the calculations, its adding it to the database, but I get this notification error that it can't convert to an int. I tried:
Code:
$new_balance = (float) $balance + (float) $total;
as there are decimals in it, but that does nothing.
Basically what i am trying to do, is take 5 inputs, add them together and add that sum to the previous balance.