0
私はページネーションで検索を実装しています。私は、ユーザーIDを持ち、fnameになど検索は、ユーザー名に基づいて登録テーブルから探していページ区切りでコード検索を行う
public function search_result($limit,$start,$search_name)
{
$this->db->limit($limit, $start);
$this->db->select('user_id');
$this->db->where('category',1);
$this->db->like('first_name',$search_name);
$query = $this->db->get('registration');
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
コントローラ機能 `パブリック関数の検索() {
if($_POST)
{
$search_name=$this->input->post('search_name');
$config['base_url'] = 'search';
$config['total_rows'] = 15;//$this->registration_model->record_count();
$config['per_page'] = 4;
$config["uri_segment"] = 3;
$config['use_page_numbers'] = TRUE;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data['result']=$this->institute_model->search_result($config["per_page"],$page,$search_name);
$data['links'] = $this->pagination->create_links();
$this->load->view('institute/search',$data);
}
}`
とモデルの機能コードです。それは私のために働くが、ページ2のページ2をクリックするとhttp://localhost/mypro/index.php/institute/search/2
に行き、空白になる。
良い。今、これまでに何が行われていますか?または既製のスクリプトがほしいのですか? –
このチュートリアルに従ってください:http://www.w3schools.com/php/php_ajax_livesearch.asp問題を遭遇した場合は、最初に研究を行います。解決策が見つからない場合は、あなたがこれまでに試したことを質問してください。 – alxbrd