如何从数据库php对象中查找和显示项

如何从数据库php对象中查找和显示项,php,database,forms,object,Php,Database,Forms,Object,我有表格 <select name="year" id="f_year"> <option value=""><?php _e('From', 'cars_attributes'); ?></option> <?php foreach($year as $y) { ?> <option value="<?php echo $y['fk_i_item_id'];

我有表格

    <select name="year" id="f_year">
        <option value=""><?php _e('From', 'cars_attributes'); ?></option>
        <?php foreach($year as $y) { ?>
            <option value="<?php echo $y['fk_i_item_id']; ?>" <?php if($years == $y['fk_i_item_id']) { echo 'selected'; } ?>><?php echo $y['i_year']; ?></option>
        <?php } ?>
    </select>


    <select name="year" id="t_year">
        <option value=""><?php _e('To', 'cars_attributes'); ?></option>
        <?php foreach($year as $y) { ?>
            <option value="<?php echo $y['fk_i_item_id']; ?>" <?php if($years == $y['fk_i_item_id']) { echo 'selected'; } ?>><?php echo $y['i_year']; ?></option>
        <?php } ?>
    </select>
现在我如何搜索这两个值之间的项。
这对于应该在他们的生产年之间搜索汽车,以DB为单位作为i_年。直到这一次,当我设置2001-2004,我点击“优化”按钮,它会显示2004-2004,没有匹配结果。(2004年有两辆车)。有什么好处吗?

由于没有回应,刷新主题

        public function getCarAttr()
    {
        $this->dao->select();
        $this->dao->from( $this->getTable_CarAttr());
      //$this->dao->where('fk_i_item_id', $itemId);
      $this->dao->groupBy('i_year', 'ASC') ;

        $result = $this->dao->get();
        if( !$result ) {
            return array() ;
        }

        return $result->result();
    }