Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14348

or_group_start Problem

$
0
0
I have a query as
PHP Code:
$this->db->or_group_start()->where('X',$x)->where('Y',$y)->group_end()->where('Z',false)->from('TABLE')->count_all_results() 

and this results

Code:
SELECT COUNT(*) AS "numrows" FROM "TABLE" WHERE ( "X" IS NULL AND "Y" IS NULL ) AND "Z" =0

sql query.

As you can see, where items connected with AND , not with OR.

When i change this code as
PHP Code:
$this->db->or_group_start()->where('X',$x)->or_where('Y',$y)->group_end()->where('Z',false)->from('TABLE')->count_all_results() 

it generates
Code:
SELECT COUNT(*) AS "numrows" FROM "TABLE" WHERE ( "X" IS NULL OR "Y" IS NULL ) AND "Z" =0

as what i want.

If i have to connect where items with this method, what about or_group_start clause? It's name may simlply group_start()

I think this is a bug or wrong method name.

Viewing all articles
Browse latest Browse all 14348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>