-2

Hi everyone in my getListQuery() method I have this query en SQL with error because I don´t know how to scape $language value

$query->from('`#__noticias` AS a');
$query->where('( a.idioma LIKE '.$language.' )');

I want to obtain this.

$query->from('`#__noticias` AS a');
$query->where('( a.idioma LIKE "es-ES" )');

any idea!

4

1 に答える 1

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.' )');
于 2013-01-22T14:15:38.657 に答える