CodeIgniter Forums

Full Version: Need help : Search with multiple fields with codeigniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]satyajit9830[/eluser]
i need to implement search functionality on multiple fields..

search on:
2. category
3. subcategory

Please help me...

El Forum

[eluser]boltsabre[/eluser]
This is not really a CI problem is it, but rather a problem with your SQL skills.

Care to give us any extra details...
- are both columns in the same table, or different tables?
- are you looking at doing an "exact" search (ie, if user enters "plants" will it only return a result if the column has exactly "plants" or something after it, for example "green plants", or something after "plants - tropical" or something before and after "green plants tropical".
- the above point, but for your second column...

Perhaps you should try coding this in vanilla php/mysql first, and then once you have it, integrate it to your CI project.

El Forum

[eluser]satyajit9830[/eluser]
Actually i want to search using more then two fields in the same table.
able to search with fixed value but not able to search with dynamic value from the url..
means some thing like advanced job search with search filters.

Please help me..

El Forum

[eluser]boltsabre[/eluser]
You're going to have to explain exactly what you're trying to achieve, what your problem is (ie. "but not able to search with dynamic value from the url" -> does this mean you're having trouble getting the value from the url?), and what code you already have.
I'm not trying to sound testy or anything, but we need more details before we can help you Smile

El Forum

[eluser]satyajit9830[/eluser]
i m sorry for this..
Actually i want to create advanced job search with search filters..

it will be search with job title, category , sub category , skill and experience.
now my problem is how can i pass the value to model if some one search with skill and title or with only experience ..
It will be very help full if u can provide me any search module..

plzzzz Sad

El Forum

[eluser]boltsabre[/eluser]
Not sure of any modules off the top of my head, I just hardcode code my filters, and if need be, save them to the session.

Basically, you just want to do this (pseudo code):
1. Get your post values in your controller from your "filters" form/view
2. Save them into your session/cookie if you want to save this search
3. Pass the post values to your model.
4. In your model, build your sql search query from the values it's just received.