试图创建一个函数,在这里我可以搜索我的数据库并获得搜索结果.错误


Trying to create a function where I can search through my database and get search results. Errors

我在网上找到了这段代码,并准确地使用了它,但它一直给我错误:

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();?>