Can you post more code?
After execute() you must use ->as_array()
, for transofrmation object to array.
->as_object('stdClass')
->execute()
->as_array();
After this you can parse results like array.
Question
Situation:
I have a controller which contains 2 functions:
public function action_all_objects()
- gathers data to show all user objectspublic function get_address()
- helper function to get address on demandso in get_adress
I have DB class query which I execute as as_object('stdClass')
.
Case:
I call get_address($addr_id)
from action_all_objects()
and in get_address
I am trying to return $result
from the query.
Problem:
FuelPHP shows error "database results are read-only"
Question:
How can I create proper helper function to get address or anything else or what should I modify to get usable result (object preferable)?
Solution
Can you post more code?
After execute() you must use ->as_array()
, for transofrmation object to array.
->as_object('stdClass')
->execute()
->as_array();
After this you can parse results like array.