Welcome Guest, Not a member yet? Register   Sign In
Why an object is passed as an array? [CLOSED]
#1

[eluser]earlyriser[/eluser]
Hi I have this code in my controller:

Code:
//bills loop. This objects array comes from a $query->result()
foreach ( $bills as $bill)
{    
     echo $bill->bill_status;  //WORKS AS I EXPECTED
     $this->Bill_model->process_bill ( $bill );    
}

And I have this in my Bill_model

Code:
function process_bill( $bill)
{
     echo $bill->bill_status; //ERROR
     echo $bill['bill_status'];  //WORKS AS I UNEXPECTED
}

The error I get is Message: Trying to get property of non-object

Why the object is passed as an array? What's the way to pass this object?

UPDATE:
It was a typing error, thanks




Theme © iAndrew 2016 - Forum software by © MyBB