[eluser]tkaw220[/eluser]
Hi,
When working with Active Record, I found below issue:
1)
Code:
$q = $this->db
->where('format', 'reader')
->or_where('format', 'reader with 3D goggles')
->order_by('brand, format, title', 'asc')
->get('products');
Query:
Code:
SELECT * FROM (`products`) WHERE `format` = 'reader' OR `format` = 'reader with 3D goggles' ORDER BY `brand`, `format`, `title` asc
Return products properly.
2)
Code:
$q = $this->db
->where('format', 'reader')
->or_where(array('format' => 'reader', 'format' => 'reader with 3D goggles'))
->order_by('brand, format, title', 'asc')
->get('products');
Query:
Code:
SELECT * FROM (`products`) WHERE `format` = 'reader' OR `format` = 'reader with 3D goggles' ORDER BY `brand`, `format`, `title` asc
Return
only products match the second parameter, which is reader with 3D goggles.
I do not understand how two codes generated one same SQL query, but return result differently. Would appreciate if someone could clarify this.
Thank you for your time.