⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

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



Pedro Bernal
  • profile picture
  • Member

Posted 26 May 2014 - 17: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!