mogy74
Member
Hi to all
i need a litle help .. again
i start reuse fabrik after long time of stop and i found a problem making a filter in a query :
i need to know the total of the "tot_uscita" field from bache out table , but i also need to filter them
from "sede" and a period set by tro datatime picker
i use calc element for do this and i have a datetime for start date the same for end date
so i set 3 varabiles as "sede" and the 2 date "start" "end"
it work until i try to do a "where" in the querry of the date , i think is by the syntax but i can't realy find the right way to write it
someone can help?
here is the code
$sede={c___sede};
$pagato=1;
$inizio= new DateTime('{c___data_di_partenza}');
$fine= new DateTime('{c___data_finale}');
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query
->select('SUM(tot_uscita)')
->from('banche_out')
->where('sede = ' . $db->quote($sede))
->where('pagato = ' . $db->quote($pagato));
->where('data_pagamento >= ' . $db->quote($inizio)) "this is the wrong line ..
->where('data_pagamento <= ' . $db->quote($fine)); "data_pagamento" is a datetime in database.
$db->setQuery($query);
$risultato = $db->loadResult();
return $risultato;
thanks to all of any help
hugs
i need a litle help .. again
i start reuse fabrik after long time of stop and i found a problem making a filter in a query :
i need to know the total of the "tot_uscita" field from bache out table , but i also need to filter them
from "sede" and a period set by tro datatime picker
i use calc element for do this and i have a datetime for start date the same for end date
so i set 3 varabiles as "sede" and the 2 date "start" "end"
it work until i try to do a "where" in the querry of the date , i think is by the syntax but i can't realy find the right way to write it
someone can help?
here is the code
$sede={c___sede};
$pagato=1;
$inizio= new DateTime('{c___data_di_partenza}');
$fine= new DateTime('{c___data_finale}');
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query
->select('SUM(tot_uscita)')
->from('banche_out')
->where('sede = ' . $db->quote($sede))
->where('pagato = ' . $db->quote($pagato));
->where('data_pagamento >= ' . $db->quote($inizio)) "this is the wrong line ..
->where('data_pagamento <= ' . $db->quote($fine)); "data_pagamento" is a datetime in database.
$db->setQuery($query);
$risultato = $db->loadResult();
return $risultato;
thanks to all of any help
hugs