Welcome Guest, Not a member yet? Register   Sign In
Using id to get another field from the table
#6

[eluser]rijobo[/eluser]
My new query with joins:

Code:
function getProduct($id){
        $data = array();
        $options = array('product.id' => $id);
        $this-> db-> select('materiaal.materiaal, soort.soort, steen.steen, product.naam, product.foto, product.langoms, product.kortoms, product.materiaal_id, product.steen_id, product.afmeting, product.prijs, product.id');
        $this-> db-> from('product');
        $this-> db-> join('materiaal', 'product.materiaal_id = materiaal.id');
        $this-> db-> join('soort', 'product.soort_id = soort.id');
        $this-> db-> join('steen', 'product.steen_id = steen.id');
        $this-> db-> where($options,1);
        $Q = $this-> db-> get();
        if ($Q-> num_rows() > 0){
            $data = $Q-> row_array();
        }
        $Q-> free_result();
        return $data;
    }


Messages In This Thread
Using id to get another field from the table - by El Forum - 12-16-2009, 07:30 AM
Using id to get another field from the table - by El Forum - 12-16-2009, 07:47 AM
Using id to get another field from the table - by El Forum - 12-16-2009, 08:31 AM
Using id to get another field from the table - by El Forum - 12-16-2009, 09:17 AM
Using id to get another field from the table - by El Forum - 12-16-2009, 09:59 AM
Using id to get another field from the table - by El Forum - 12-16-2009, 10:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB