Welcome Guest, Not a member yet? Register   Sign In
Object of class stdClass could not be converted to int
#1

[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.


Messages In This Thread
Object of class stdClass could not be converted to int - by El Forum - 05-09-2012, 01:00 PM
Object of class stdClass could not be converted to int - by El Forum - 05-09-2012, 01:02 PM
Object of class stdClass could not be converted to int - by El Forum - 05-09-2012, 02:54 PM
Object of class stdClass could not be converted to int - by El Forum - 05-09-2012, 04:29 PM
Object of class stdClass could not be converted to int - by El Forum - 05-09-2012, 05:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB