Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.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
Php joomla组件搜索_Php_Joomla_Components - Fatal编程技术网

Php joomla组件搜索

Php joomla组件搜索,php,joomla,components,Php,Joomla,Components,请协助我的模型能够从数据库中获取数据,但如果我想要一个特定的结果集,则无法进行筛选,因为它会不断提供相同的数据 这是我的密码。提前谢谢你的帮助 public function __construct($config = array()) { $config['filter_fields']=array( 'b.start', 'd.`title` ', 'e.`ti

请协助我的模型能够从数据库中获取数据,但如果我想要一个特定的结果集,则无法进行筛选,因为它会不断提供相同的数据

这是我的密码。提前谢谢你的帮助

public function __construct($config = array()) {
                $config['filter_fields']=array(
                'b.start', 
                'd.`title` ', 
                'e.`title`');
                parent::__construct($config);
        }

     function getListQuery()
     {
     $db = JFactory::getDBO();
         $query = $db->getQuery(true);
     $query->select('a.firstname, a.lastname, b.start, c.flightnumber, d.`title` TO_NAME, e.`title` FROM_NAME, c.id');  
     $query->from(' #__bookpro_passenger as a');
     $query->JOIN('INNER', '#__bookpro_orderinfo as b ON a.order_id = b.order_id');
     $query-> JOIN('INNER','#__bookpro_flight as c ON b.obj_id = c.id');
     $query-> JOIN('INNER','#__bookpro_dest as d ON c.desfrom = d.id');
     $query->  JOIN('INNER',' #__bookpro_dest as e ON c.desto = e.id');



       $destfrom = $this->getState('filter.from');
                if (!empty($destfrom)) {
                $destfrom = $db->Quote('%'.$db->escape($destfrom, true).'%');
                $query->where('(e.`title` LIKE '.$destfrom.')');
    }


       $destfrom = $this->getState('filter.to');
                if (!empty($destfrom)) {
                $destto = $db->Quote('%'.$db->escape($destto, true).'%');
                $query->where('( d.`title` LIKE '.$destto.')');
    }
    return $query;
    }

     function populateState()
        {

                $app = JFactory::getApplication();


                $destfrom = $app->getUserStateFromRequest($this->context.'.filter.from', 'filter_from');

                $this->setState('filter.from', $destfrom);
                $destto = $app->getUserStateFromRequest($this->context.'.filter.to', 'filter_to');

                $this->setState('filter.to', $destto);


                parent::populateState();
    }
}

您还应该在模型中为
过滤器覆盖populateState()。到
,以及
过滤器。从

protected function populateState($ordering = null, $direction = null) {
  $app = JFactory::getApplication('administrator');
  $filter.to = $app->input->get('filter.to');
  $this->setState('filter.to', $rfilter.to);
  // ...
  // your default sorting
  parent::populateState('a.firstname', 'asc');
}

无论哪种方式,都要检查
$this->getState('filter.from')
的设置是否正确

如果没有表格和表格的细节,就很难判断问题出在哪里。另外,如果第二个
条件看起来也不正确,它应该是
$destto=$this->getState('filter.to');如果(!empty($destto)){