title: Foreach skipping, joomla framework in using
body: <p>I have in using joomla, have a input field and must add on result page of com_search a additional query, if i run this query in a sql editor i get 2 results, but in joomla is my <em>foreach</em> every time skipping.</p>
  
  <p>If i do <em>$db->getPrefix();</em> i see table prefix, so i thing to $db and $query are true.</p>
  
  <pre><code>$db = JFactory::getDbo();
  $query = $db-&gt;getQuery(true);
  $query-&gt;select('*');
  $query-&gt;from('#__k2_categories');
  $query-&gt;where("`name` LIKE '%MY_SEARCH_WORD%'");
  $db-&gt;setQuery($query);
  $results = $db-&gt;loadObjectList();
  
  foreach($results as $entry) :
  
  echo $results-&gt;name . "&lt;br /&gt;";
  
  endforeach;
  </code></pre>