0

I am trying to get an older Joomla component (that uses DeepL to translate) to work and it seems to go fine until I try to run the translator. I've troubleshot it down to this piece of code that is throwing the error:

Unknown column '*' in 'field list'

. The code:

$query = $db->getQuery(true);
    $query->select($db->quoteName('*'))
      ->from($db->quoteName($query_details['cat_table']))
      ->where($db->quoteName('parent_id') . ' != 0')
      ->where($db->quoteName('extension') . ' = ' . $db->quote($query_details['component']));
    $db->setQuery($query);
    $categories = $db->loadObjectList();
    $cleanedCategories = array();
    foreach ($categories as $cat ) {
    $cleanedCategories [$cat->id] = $cat->title;
        }

Any help getting this work would be greatly appreciated by many!

  • You may not need to specify the select since you're getting all of the columns. – aynber May 20 '22 at 14:13
  • So how would that be addressed? – Charlie Trig May 20 '22 at 15:02
  • Remove `->select($db->quoteName('*'))`, see if it works. Otherwise, since it's not a name and doesn't need quotes, try `->select('*')` – aynber May 20 '22 at 15:09
  • select ('*') worked, got a little farther, now it's throwing: syntax error, unexpected 'No' (T_STRING), expecting ')' so, more work to do. Thank you for your help! – Charlie Trig May 20 '22 at 15:19
  • Please ask your Joomla questions on [joomla.se] Stack Exchange. FYI: `loadAssocList('key', 'column')` can accept parameters. – mickmackusa May 29 '22 at 05:38
  • It would also help you and others to debug sql problems if you [`dump()` your rendered query](https://stackoverflow.com/a/72422351/2943403). – mickmackusa May 29 '22 at 10:44

0 Answers0