Hello,
Here is the problem I have:
I have a table for state, city, category, citydetails
I am able to query the state table on my php script to display the cities from that state.
Now, I am also able to display the category for the city selected. But it's not accurate.
Here is why:
My category table has just 2 columns: id, and category. It does not have any details about the city or state (as fk's)
The reason I did not add that is beacuse all cities from all state have the same category.
So I am just selecting * from category whenever a city is clicked. The problem is if I want details on a particular city, lets say Los Angeles, the query is not displaying values from Los Angeles, it is displaying values from all the cities with the category, lets say 'Cars'.
Is there a way to overcome this?
I hope my question is clear!
Just to iterate, I have a page which displays all the major cities based on the state selected. Now when a city is clicked, categories for that city should be displayed for example: Cars, Schools, Parks, and so on. Since these categories are the same for all the cities in all the states, I don't know to specify what category is for what state in my mysql table. Apparently, when I do the query, it does not have any details about the city and state so my query is displaying all values for that category.
Can anyone please help me? Should I alter my table to have city and state as fk's or can i query in such a way I can display only details of a category of the city selected.
Just so to let you know, when i click a state I am able to get all the cities on that state and when I click a city, $_GET does have the value of the city I selected, but I am just querying for the same results for all cities.
Please help.
Thanks in advance.
Regards,