0

我尝试解决标题,但我真的很想知道解决方案,哦,有错误的代码在这里:

<?php
class Schedules extends CI_Controller {


function display($query_id = 0, $sort_by = 'event_name', $sort_order = 'asc', $offset = 0) {
    
    $limit = 20;
    $data['fields'] = array(
        'event_id' => 'ID',
        'event_name' => 'Title',
        'schedule' => 'Schedule',
        'date_expired' => 'Expired',
        'clientname' => 'Clientname',
        'cost' => 'Cost'
    );
    $this->input->load_query($query_id);
    
    $query_array = array(
        'event_name' => $this->input->get('event_name'),
        'date_expired' => $this->input->get('date_expired'),
        'length_comparison' => $this->input->get('length_comparison'),
        'date_expired' => $this->input->get('date_expired'),
    );
    $data['query_id'] = $query_id;
    
    $this->load->model('Schedule_model');
    
    $results = $this->Schedule_model->search($querry_array, $limit, $offset,     $sort_by, $sort_order); // this is line number 27 which displays  error
    
    $data['schedules'] = $results['rows'];
    $data['num_results'] = $results['num_rows'];
> Call to undefined function form_open() in C:\xampp\htdocs\ci\application\views\schedules.php on line 34//Also this error display too, code here:

<?php echo form_open('schedules/search'); ?>//this line is number 34 that display an error
    <div>
        <?php echo form_label('Event Name:', 'event_name'); ?>
        <?php echo form_input('event_name', set_value('event_name'), 'id="event_name"'); ?>
    </div>

    <div>
        <?php echo form_label('Schedule:', 'schedule'); ?>
        <?php echo form_dropdown('schedule', $category_options, 
            set_value('schedule'), 'id="schedule"'); ?>
    </div>

    <div>
        <?php echo form_label('Date Expiree:', 'date_expired'); ?>
        <?php echo form_dropdown('length_comparison', 
            array('gt' => '>', 'gte' => '>=', 'eq' => '=', 'lte' => '<=', 'lt' => '<') , 
            set_value('length_comparison'), 'id="length_comparison"'); ?>
        <?php echo form_input('date_expired', set_value('date_expired'), 'id="date_expired"'); ?>
    </div>
    
    <div>
        <?php echo form_submit('action', 'Search'); ?>
    </div>

<?php echo form_close(); ?>
4

1 回答 1

5

错字:

$results = $this->Schedule_model->search($querry_array, etc...
                                             ^-- extra R

由于您已将其定义为:

$query_array = array(
    ...snip...

早些时候,与ONE r

于 2013-01-16T14:53:37.343 回答