Welcome Guest, Not a member yet? Register   Sign In
Search results page and pagination
#1

[eluser]ccachor[/eluser]
I'm having some trouble with a concept here in MVC and CI. Basically, I'm building some functionality into a real estate for a friend where people could search for houses. There's about 92,000 listings in the database so queries can become a problem if I'm not careful.

I'm just curious how to display records based on a search query and then include pagination for those results. From what I've read the _GET method is not allowed and most people use the URI segment but when I click a link to the next page I lose my query data based on the URI segment.

What I would like to do is have a Listings controller with the index function taking POST values from forms to query the database and display listings. Then I would have a detail function that just loads the details for the listings and an email function to send the sales lead. Is this possible to take POST variables on an index function and include pagination on those results? I'm sure it's a piece of cake to everyone but I'm just getting started with PHP and CI Smile

Help would GREATLY be appreciated!
#2

[eluser]xwero[/eluser]
If you don't have too many criteria for searching you could put the post variables in a session and use the session variables to build your query. If they want to change or make a new query you replace the criteria or remove them all together to add the new.

In addition of storing the post values in a session you can store them in the database too with more logging data like how many pages are watched, how many houses are clicked, ... . This way you can generate a nice report about the searchers behaviour for the sales department with graphs if you want Wink

ps : for the pagination you use a count query with the session variables to create the links.




Theme © iAndrew 2016 - Forum software by © MyBB