Active CodeIgniter entry, Add IF statement to & # 8594; select ()

I have this query:

$this->db->select("
    IF(predicts.predict_owner = votes.vote_user_id , IF(judges.judge_did_accept = 1 , True , False) , 'NotExists' )" , 'user_judgement');

I get a syntax error on

  `'NotExists'` )

If I run a query directly in the database, it works fine ...
Is there a way to prevent CI from adding the โ€œautomaticallyโ€ sign?

thank

+5
source share
1 answer

You can call the select method with FALSE as the last parameter, e.g.

$this->db->select("IF(predicts.predict_owner = votes.vote_user_id , IF(judges.judge_did_accept = 1 , True , False) , 'NotExists' ),'user_judgement'",false);

This will allow CI to add `

From user manual

$this- > db- > select() . FALSE, CodeIgniter . , select.

PS: , select "user_judgement", , , Cay CI, , Active Record

+19

All Articles