I am trying to connect to the #__contact_details db and get some info from there for a custom module.
public function getContact(Registry $params, SiteApplication $app)
{
$db = Factory::getContainer()->get('DatabaseDriver');
$cid = (int) $params->get('main_contact');
$query = $db->getQuery(true);
$query
->select($db->quoteName(['name', 'con_position', 'address', 'suburb']))
->from($db->quoteName('#__contact_details'))
->where($db->quoteName(('id') . ' = '. $cid));
$db->setQuery($query);
return $list = $db->loadObject();
}
it gives Unknown column 'id = 1' in 'where clause' error. There is a column id in the db. How do i correct this? Thank you so much.