Welcome Guest, Not a member yet? Register   Sign In
Lost in the middle of mysql and objects
#1

[eluser]andriu[/eluser]
Hi guys.

First of all I want to say thanks for quick response and help recieved on this forum!

Ok, Im a bit lost.

I have 3 tables.
Code:
proforma
     proforma_products
             proforma_products_discounts

I would like to get results and pass it all as one object.

To do this im trying:
Code:
$query = $this->db->get_where('proforma', array('id' => $id),1);
$row = $query->row();

$query = $this->db->get_where('proforma_products', array('proforma_id' => $id));
        $row->products = $query->result();

// now i want a query that add the discounts(if there is any) for the relevant product to the object
// but i'm a bit lost.
$row->products->discount = $query->result();

I'm not that used with working with objects.
My solution would be doing a for() with php and add it to an multidimensional array.

Thanks for any help!


Messages In This Thread
Lost in the middle of mysql and objects - by El Forum - 10-25-2009, 09:30 AM
Lost in the middle of mysql and objects - by El Forum - 10-25-2009, 11:22 AM
Lost in the middle of mysql and objects - by El Forum - 10-25-2009, 03:52 PM
Lost in the middle of mysql and objects - by El Forum - 10-25-2009, 05:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB