Where is where [message #2229] |
Sat, 18 July 2009 04:22 |
edortizq
Messages: 82 Registered: August 2008 Location: Ecuador
|
Member |
|
|
I've created a new class (with no phisycal file on db), this class have a select from 4 tables (files .class and .dict attached); when I instance the class the fields in where clause requires must be qualificated, if not, it gives an error on the SQL sentence execution; when the fields are qualificated the where clause of the query dissapears.
That's the query
$object =& singleton::getInstance('evento_informe_resumen_q1');
$_idevento = $fieldarray['idevento'];
$object->sql_orderby = 'descripcionlocalidad';
$object->sql_where .= 'ti.idevento= '.$_idevento.' and tm.idtipomovimiento = 1';
$outarray = $object->getData();
And the sql log records this:
SELECT SQL_CALC_FOUND_ROWS lo.idlocalidad, lo.descripcionlocalidad, ti.idevento, lt.idtipomovimiento, tm.descripciontipomovimiento, count(*) as ingresos FROM localidad lo left join tarifa ta on lo.idlocalidad = ta.idlocalidad left join ticket ti on ta.idtarifa = ti.idtarifa left join logticket lt on ti.idticket = lt.idticket right join tipomovimiento tm on lt.idtipomovimiento = tm.idtipomovimiento GROUP BY lo.idlocalidad, lt.idtipomovimiento ORDER BY descripcionlocalidad
As you see there in no where clause. Please you help
|
|
|