I don't understand the world right now. I try to make a simple query from the DB, but it fails with the message that the column is not known. I do not understand why Joomla! tries to see the value I am looking for as a column. This is my query:

            $data = new stdClass();
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
                $query->where($db->quoteName('element') . " = " . $db->quoteName('com_componentname'));
            $data->params = $db->loadObject();

        }catch(Exception $e){
            $data->query = $query->dump();
            $data->errormsg = $e->getMessage();

        return $data;

        return false;

The response is:

'errormsg' => 'Unknown column \'com_componentname\' in \'where clause\'',

Why does Joomla! try to find the component name as a column? What I want: Where componentname in Columns name from table extensions.

Or is there another / better way to load the parameters of a component within a module?

1 Answer 1


JDatabaseDriver::quoteName() is for quoting SQL identifiers. Use JDatabaseDriver:quote() to quote and escape strings.

$query->where($db->quoteName('element') . ' = ' . $db->quote('com_componentname'));
  • unbelivable - thank you... did you know also why it had not worked like so: $query->where('element = com_componentname') ? it throws the same error...
    – Marco
    Jul 9, 2020 at 10:01
  • 1
    Because com_componentname must be quoted.
    – Sharky
    Jul 9, 2020 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.