Two queries in getListQuery() Joomla 2.5

511 views
Skip to first unread message

Christian Lusardi

unread,
Jul 16, 2013, 9:42:13 AM7/16/13
to joomla-de...@googlegroups.com
In my model I have this function

function getListQuery()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('id_servizi_aggiuntivi, id_persona , id_servizio , nome_servizio');
$query->from('#__servizi_aggiuntivi as serviziaggiuntivi, #__elenco_servizi');
$query->where('cod_servizio=id_servizio');
$result1 = $db->loadObjectList();


//$db->setQuery($query);
/*
$query = $db->getQuery(true);
$query->select('id_tipologia_socio, id_servizio as cod_servizio, nome_servizio');
$query->from('#__associazione_servizi as serviziassociati, #__elenco_servizi');
$query->where('cod_servizio=id_servizio');
$result1 = $db->loadObjectList();*/


return $query;
}

The second query is commented beacause doesn't work! Can I make 2 query in this function?

Bakual

unread,
Jul 16, 2013, 10:12:05 AM7/16/13
to joomla-de...@googlegroups.com
The getListQuery() function should only return one $query. You're also not supposed to already run the query using loadObjectList. Just build the $query and return it.
To get a second query, you need a new function (like getSecondQueryItems()) or even call a different model depending on what you need.
Reply all
Reply to author
Forward
0 new messages