Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Joomla MySQL 1054未知列';数组';_Joomla - Fatal编程技术网

Joomla MySQL 1054未知列';数组';

Joomla MySQL 1054未知列';数组';,joomla,Joomla,我正在使用Joomla 3.1,代码中有一个错误1054未知列“Array”,请帮助我修复它 protected function getOptions() { // Initialize variables. $options = array(); $varname = (string) $this->element['varname']; $project_id = JFactory::getApplication()->input->ge

我正在使用Joomla 3.1,代码中有一个错误1054未知列“Array”,请帮助我修复它

protected function getOptions()
{
    // Initialize variables.
    $options = array();

    $varname = (string) $this->element['varname'];
    $project_id = JFactory::getApplication()->input->get($varname);
    if (is_array($project_id)) {
        $project_id = $project_id[0];
    }

    if ($project_id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);

        $query->select('id AS value');
        $query->select('CASE LENGTH(name) when 0 then CONCAT('.$db->Quote(JText::_('COM_JOOMLEAGUE_GLOBAL_MATCHDAY_NAME')). ', " ", id) else name END as text ');
        $query->from('#__joomleague_round ');
        $query->where('project_id = '.$project_id);
        $query->order('roundcode');
        $db->setQuery($query);
        $options = $db->loadObjectList();
    }

显然,
$project\u id[0]
仍然保存着一个数组。因为我不知道
$this->element['varname']
从哪里来,所以很难说变量包含什么:-)

还需要注意的是:在查询中使用输入之前,您可能应该对其进行过滤,尤其是在示例中使用未经scaped的输入时。至少使用
(int)
将其强制为数字


要转储一些变量内容,我可以推荐JDump。这是JED()上提供的非商业扩展。

感谢您的回复。但对我来说,这是一个艰难的选择,我是一个新手。如果可能的话,我提供了一个完整的文件和所有您需要解决的错误。