Monday, February 20, 2012

Simple search in codeigniter

Modified the table with:

Alter table listeditems add
FULLTEXT KEY search
(category,subcategory,title,details,address);

The search results was passed to the query:
$query ="SELECT * FROM listeditems WHERE MATCH (category,subcategory,title,details,address) AGAINST ($searchterm) > 0";

The problem is:

1. Search strings should have a minimum length. This is generally three or four characters, but depends on configuration.

2. If you have fewer than three rows of data, you won’t get any search results back.

How can this problem be solved


Pasing parameter to default controller

To pass parameter to index of this controller?
i.e. http://example.com/param1/param2

in the
public function index()
{
$param1 = $this->uri->segment(1);
$param2 = $this->uri->segment(2);

}

Simple solution
Thank you sir for I got it solved with this simple thing

folder - frontarea
controller - frontpage
function - somefunction

$route['(:any)'] = "frontarea/frontpage/somefunction/$1";