codeigniter - How to combine and & or operators in grocery crud -


I am using codeigniter and grocerycrud, I want to set up table with grocerycrud like this:

  SELECT * FROM from `dashboard`. 'Medid_ludlum` where FK_ludlum =' 190.26.88.131 'and date & gt; = '2014-03-04 09:40:00' and date & lt; = '2014-03-05 09:40: 00' and (ErrorGode = 1 or Audio_Status = 1);   

I tried to do this:

  $ uno = '1'; $ crud2 = new grocery store (); $ Crud2- & gt; set_theme ('datatables'); $ Crud2- & gt; Where ('FK_ludlum', $ ludlum_id); $ Crud2- & gt; Where ('date & gt; =', $ fechainicio); $ crud2- & gt; Where ('date & lt; =', $ fechafin); $ crud2- & gt; Where ('error_code =', $ uno); $ crud2- & gt; Or_where ('audio_status =', $ uno); $ Crud2- & gt; set_table ('medidas_ludlum'); $ Crud2- & gt; Column ('measurement', 'fecha', 'audio_status', 'high_alarm_status', 'low_alarm_status', 'over_range_status', 'monitor_status', 'error_code'); $ Crud2- & gt; set_language ("Spanish"); $ Crud2- & gt; unset_add (); $ crud2- & gt; Unset_delete (); $ crud2- & gt; Unset_edit (); $ Crud2- & gt; unset_read (); $ Data ['crud2'] = $ crud2- & gt; Render ();   

Although this is not giving the right result, for example, I'm getting rows that are out of range, is there a way to install the CRUD?

Grocery curd is also using the active record of coding so that you get your where ( ) can group with grouped conditions as the bottom, or_ where () function

  $ crud2-> gt; There is no need to use '(error_code ='. $ Uno. 'Or' audio_status = '. $ Uno') ', null, FALSE).   

or

  $ crud2-> Where ('(error_code = 1 or audio_status = 1)', blank, incorrect);   

The problem occurs in your query when you use the or_ where () function, where this section is and error_code = 1 or audio_status = 1 and the approach I have provided will give you where in the form of and (error_code = 1 or audio_status = 1) a group condition

< / p>

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -