0

一旦我得到它的工作,我将把 SQL 代码移动到一个模型中,我知道它应该在那里。但如果它一开始就不起作用,它也无济于事。我可能遗漏了一些东西,但是我如何将 SQL 结果“id”作为超链接(例如超链接 www.mainsite.com/hw/id/$id)

我已经转发了我的 index.php。

电流控制器:

function index()
{
    $this->load->library('pagination');
    $this->load->library('table');
    $this->load->library('form_validation');
    $this->load->helper(array('html','url'));

    $config['base_url'] = '/index.php/hw/id';
    $config['total_rows'] = $this->db->get('HWC')->num_rows();
    $config['per_page'] = 20;
    $config['num_links'] = 1;
    $config['full_tag_open'] = '<div class="pagination pagination-centered"><ul>';
    $config['full_tag_close'] = '</ul></div>';
    $config['cur_tag_open'] = '<li class="active"><a href="#">';
    $config['cur_tag_close'] = '</a></li>';
    $config['num_tag_open'] = '<li>';
    $config['num_tag_close'] = '</li>';
    $config['first_tag_open'] = '<li>';
    $config['first_tag_close'] = '</li>';
    $config['last_tag_open'] = '<li>';
    $config['last_tag_close'] = '</li>';

    $this->pagination->initialize($config);

    $this->db->distinct();
    $this->db->order_by('Col');
    $this->db->select('*');
    $where = array('ModelName IS NOT NULL' => null);

    $data['records'] = $this->db->get_where('HWC', $where, $config['per_page'], $this->uri->segment(3));

    $result = $this->table->set_heading('HWC #', 'Col #', 'Model Name', 'Series', 'Color', 'Tampo', 'Base Color', 'Base Type', 'Window Color', 'Interior Color', 'Wheel Type', 'Toy #', 'Country', 'Notes', 'Series #', 'Year Produced');
    $data['main_content'] = 'hw_view';
    $this->load->view('includes/template', $data);
}

目前看来:

<?php
  echo $this->table->set_template(array('table_open' => '<table class="table table-condensed table-hover">'));
  echo validation_errors('<p class="error">');
  echo $this->table->generate($records);
  echo $this->pagination->create_links();
?>
4

0 回答 0