SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Dec 2004
    Location
    San Francisco
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help on displaying Mysql data using PHP

    I have a list of places in the MySQL table with columns City_Name, Region_Name and Country_Name. I would like to pull the list of Cities based on the User Input. If there is only one city returned there is no problem in displaying the result. But if I have receive more than 1 result from the database (which is most likely, as there will be multiple cities in the world with the same name), then I need to have a way of showing the results by County and by Region as in the attached picture, so that the user could select the appropriate city.

    I would like to show the results by County and when the User clicks Country the Region listing should expand. As far as the Expanding and Collapsing I could do using JavaScript. But how could I loop through the results and show him to the user. Also how can I display the results in two columns as I don't want the results to occupy lot of space.

    Please see the picture you would better understand the problem.

    I would appreciate it if somebody could provide some assistance. Thanks in advance.
    Attached Images Attached Images

  2. #2
    SitePoint Addict
    Join Date
    Dec 2004
    Location
    San Francisco
    Posts
    263
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for those who viewed this post. But as unfortunately nobody could provide their input, I would like to inform that I finally found excellent resource after googling several times. For those of you who would like to achieve what I was trying to achieve, visit:

    http://www.garfieldtech.com/blog/php-group-by

    Hope this helps someone like me.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •