This is a headache issue for long time. I have the following code in codeigniter php active record.
$this->db->select('*');
$this->db->from('orders');
$this->db->join('order_detail', 'order_detail.order_id = orders.o_id');
$this->db->join('profiles','profiles.id = orders.buyer_id','left');
$this->db->where('orders.o_id', $order_id);
$this->db->group_by('orders.o_id');
$query = $this->db->get();
$order_details_by_order_id_result = (object)$query->result();
result
var_dump($order_details_by_order_id_result);exit; //see below
object(stdClass)[34]
public 0 =>
object(stdClass)[37]
public 'xx_id' => string '13' (length=2)
public 'yy_iud' => string '22' (length=10)
public 'order_total' => string '25.00' (length=5)
public 'shipto_fname' => string 'dan' (length=3)
public 'shipto_lname' => string 'theman' (length=6
on my controller i called the above function as follow:
$order_details = $this->orderdetails->get_orderdetail_of_buyer($oid);
$data['order_details'] = $order_details; //pass this to the view
$this->load->view('dashboard/order_detail_view',$data);
and i want to send the result to the view (/order_detail_view.php) Order #o_id ;?>
$order_details->o_id; //why on earth this expression show me error
i guess the problem is
object(stdClass)[34] public 0 =>
How could i ever solve this because i fetch only one order at a time. Thanks