[eluser]otherjohn[/eluser]
Can you all help me with this:
this Does not work
Code:
$this->db->select('Options.name, Agents_Options.price');
$this->db->from('Options, Agents_Options, Products_Options');
$this->db->where('Agents_Options.agent_id', $this->agent->id);
$this->db->where('Agents_Options.state', $this->state);
$this->db->where('Agents_Options.options_id', 'Options.id');
$this->db->where_in('Products_Options.product_id', $this->products); //products is array
$this->db->where('Products_Options.options_id', 'Options.id');
but this works?:
Code:
$sql = 'SELECT o.name, ao.price
FROM Options o, Agents_Options ao, Products_Options po
WHERE ao.agent_id = ' . $this->agent->id
. ' AND ao.state = "' . $this->state . '"
AND ao.options_id = o.id
AND po.product_id IN (' . implode(", ", $this->products) . ') AND po.options_id = o.id';
$query = $this->db->query($sql);
Can someone help me figure out why the earlier doesnt work.
john