大家好我的getListQuery()方法我有这个查询带有错误的SQL,因为我不知道如何scape $语言值
$query->from('`#__noticias` AS a');
$query->where('( a.idioma LIKE '.$language.' )');
我想获得这个。
$query->from('`#__noticias` AS a');
$query->where('( a.idioma LIKE "es-ES" )');
任何想法!
答案 0 :(得分:0)
做到这一点
$lan = $db->Quote('%'.$db->escape($language, true).'%');
最后
$db = $this->getDbo();
$query = $db->getQuery(true);
$language =& JFactory::getLanguage()->getTag();
$lan = $db->Quote('%'.$db->escape($language, true).'%');
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select', 'a.*'
)
);
$query->from('`#__noticias` AS a');
$query->where('( a.idioma LIKE '.$lan.' )');