Welcome Guest, Not a member yet? Register   Sign In
Quotre pb in WHERE clause
#1

[eluser]Semaphore[/eluser]
Hi pepeole,
I'm searching since 2 hours on this pretty simple pb :

I'm trying to make a simple request with a date pick from a Jquery UI datpicker in french format (DDMMYYYY) but it seems I have some quotes pb with the resulting string :

Code:
//convert to mysql DATE format for WHERE clause
  $datearrayfrom = explode('/',$from);
  $datefrom = $datearrayfrom[2].'-'.$datearrayfrom[1].'-'.$datearrayfrom[0];
  
  //convert to mysql DATE format for WHERE clause
  $datearrayto = explode('/',$to);
  $dateto = $datearrayto[2].'-'.$datearrayto[1].'-'.$datearrayto[0];
  
  $this->db->select('id_rampe')
    ->select_sum('duree','duree_cumul')
    ->select_sum('energie')
    ->from('lumiere_apport')
    ->where('date>=',$datefrom)
    ->where('date<=',$dateto)
    ->group_by('id_rampe') ;
  $query = $this->db->get();

If I add FALSE to the WHERE clause of course the 'date' became date and recognised as MYSQL date function. The date column is in date format.

Thanks for your help on this...

Edit : I have test with other name than date (not my choice ^^) but no change




Theme © iAndrew 2016 - Forum software by © MyBB