Я нашел этот код онлайн и использовал его точно, но он продолжает давать мне ошибки:
Severity: Warning
Message: Missing argument 1 for Books_model::get_search(), called in controller on line 23 and defined
CONTROLLER
function search()
{
$data['query'] = $this->Books_model->get_search();
$this->load->view(‘books, $data);
}
MODEL
function get_search()
{
$match = $this->input->post(‘search);
$this->db->like(‘bookname,$match);
$this->db->or_like(‘author,$match);
$this->db->or_like(‘characters,$match);
$this->db->or_like(‘synopsis,$match);
$query = $this->db->get(‘books);
return $query->result();
}
VIEWS
<?=form_open(‘books/search);?>
<?php $search = array(‘name=>search,'id=>search,'value=>",);?>
<?=form_input($search);?><input type=submit value=Search /></p>
<?=form_close();?>
контроллер
function search()
{
$match = $this->input->post(‘search);
$data['query'] = $this->Books_model->get_search($match);
$this->load->view(‘books, $data);
}
Модель
function get_search($match = NULL)
{
$this->db->like(‘bookname,$match);
$this->db->or_like(‘author,$match);
$this->db->or_like(‘characters,$match);
$this->db->or_like(‘synopsis,$match);
$query = $this->db->get(‘books);
return $query->result();
}
Просмотры
<?=form_open(‘books/search);?>
<?php $search = array(‘name=>search,'id=>search,'value=>",);?>
<?=form_input($search);?><input type=submit value=Search /></p>
<?=form_close();?>