[eluser]Brokenegg.wb[/eluser]
ok, so i'm creating an e-commerce site for intaglio seals, i have everything pretty much hammerd out except the function that allows the user to search for spicific items, heres what i have so far:
in the Controller:
Code:
function search()
{
$this->load->library('pagination');
$this->load->library('table');
$config['base_url'] = 'http://www.rareintaglio.com/index.php/store/search';
$config['total_rows'] = $this->db->get('items')->num_rows();
$config['per_page'] = 12;
$config['num_links'] = 7;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$data['result'] = $this->site_db_upload->get_records_store_search();
$this->load->view('test', $data);
}
site_db_upload:
[
Code:
function get_records_store_search()
{
/*$config['base_url'] = 'http://www.rareintaglio.com/index.php/store';
$config['total_rows'] = $this->db->get('items')->num_rows();
$config['per_page'] = 9;
$config['num_links'] = 7;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->db->select('item_name, attribution, material, age, date_acquired, price');
$this->db->from('items');*/
$keywords = $this->input->post('keywords');
$where = "(`Item_name` LIKE '%".$keywords."%' OR `attribution` LIKE '%".$keywords."%' OR `material` LIKE '%".$keywords."%' OR `age` LIKE '%".$keywords."%' OR `description` LIKE '%".$keywords."%')";
$this->db->where($where, NULL, FALSE);
$query = $this->db->get_where('items', $where);
return $query->result();
}
The issue is that they search returns all entries in the database instead of only those that are relevant.
Thanks,
Watson