Returning unique values of a multi-dimensional array with CodeIgniter PHP

Question!

I'm developing a property rentals website. The search results page will contain a list of property results. It is my intention to redefine the results, say by town, country, property type etc.

So let's say for example the user searches 'France'. All of the relative properties will be returned and displayed in a list.

However, I also need to reuse this array, to display only unique town names from the search results array. e.g. Montpellier, Lyon, Rennes, Nice etc. The idea is when use user click on 'Nice', only the 'Nice' properties would return. I would also like to display how many properties are in that town.

The closest example as to what I want to achieve. http://www.miaandmaggie.com/dog-collars-leashes.html

Any ideas how I can use my search array to display the unique towns of the search?

Many thanks! M



Answers
1
By : damko


A couple of things I noticed:

  • For the country parameter, just pass the country code directly instead of having a lot of if-else blocks to choose from several countries.
  • Isn't the $Q-
By : Randell


This video can help you solving your question :)
By: admin