com_search and additional query

30 views
Skip to first unread message

Marco Polli

unread,
Oct 2, 2013, 5:45:55 AM10/2/13
to joomla-de...@googlegroups.com
Hi, i tried to get the searchword and want to do an additional query, my code is below joomla standard code and is in a override file, in using is: default_results.php:

My code for DB looks so:

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from('zgclh_k2_categories');
$query->where("`name` LIKE '%MY_SEARCH_WORD%'");
$db->setQuery($query);
$results = $db->loadObjectList();

foreach($results as $entry) :
echo $results->name . "<br />";
endforeach;

If i run my query in a DB editor, with my searchword i get 3 results and that's ok. but here is something wrong in my foreach, because i have tested where is the error, can someone give me any ideas to solve this problem?

Dmitry Rekun

unread,
Oct 3, 2013, 1:14:28 AM10/3/13
to joomla-de...@googlegroups.com
Hi.

It should be $entry->name

Dmitry

Reply all
Reply to author
Forward
0 new messages