Jump to content


Error with query using mayor or equal in Grocery Crud and Code Igniter

codeigniter mayor or equal error

  • Please log in to reply
No replies to this topic

#1 Pedro Bernal

Pedro Bernal

    Member

  • Members
  • PipPip
  • 12 posts

Posted 26 May 2014 - 05:34 PM

I am having an issue with grocerycrud, I am collecting decimal values every 5 minutes and storing them into a table named medidas_ludlum_5min, I have a view that allows to the user select a date range, a value and ">", "=" or ">=" options.

After that I process the selection with a switch in my controller and with GroceryCrud I am showing the results of the query.

When I select values higher than 0, it works good and I have two results:

Code:

$crud->where('(FK_ludlum="'.$ludlum_id.'"
and measurement > "'.$medida.'"
and fecha between "'.$fechainicio.'" and "'.$fechafin.'")',null,FALSE);

Results:

Measurement____________________Date

10_____________________________22/04/2014 - 17:18

11.5___________________________22/04/2014 - 17:23

However using the same date range with >= than 0 I just got the cero values.

Code:

$crud->where('(FK_ludlum="'.$ludlum_id.'"
and measurement >= "'.$medida.'"
and fecha between "'.$fechainicio.'" and "'.$fechafin.'")',null,FALSE);

Results:

Measurement____________________Date

0______________________________22/04/2014 - 17:13

0______________________________22/04/2014 - 17:28

0______________________________22/04/2014 - 17:33

0______________________________22/04/2014 - 17:38

0______________________________22/04/2014 - 17:43

As you can see the two values higher than cero are not presented in the groceryCrud table.

 

As an additional note I am using the same query to feed a google chart and it works perfect:

$sql = $this->db->query('SELECT * FROM medidas_ludlum_5min where FK_ludlum="'.$id.'"
and measurement >= "'.$medida.'"
and fecha between "'.$fechainicio.'" and "'.$fechafin.'"');

I dont know why is this happening any help will be apreciated, If someone needs more code just tell me and I can post it or message it.

Thanks!


Edited by Pedro Bernal, 26 May 2014 - 05:39 PM.






Also tagged with one or more of these keywords: codeigniter, mayor or equal, error

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users