What you are talking about is a many to many relationship. This is accomplished using a lookup table - here's an example:
Code:
news table
==========
news_id
headline
body
date_added
aid
cities table
============
city_id
city_name
news_cities table
=================
news_id
city_id
The news table stores news articles, the cities table stores cities and the news_cities stores information on which articles belong to which cities. For example, an entry in the news_cities table with news_id set to "3" and city_id set to "5" would mean that news article number 3 is related to city number 5. Articles can be in as few or as many cities as you like.
To get information back out of the table you use select joins. The followign query will return all of the news stories applicable to a city with ID number $id:
PHP Code:
$result = mysql_query("SELECT news.*, cities.city_name
FROM news, cities
WHERE news.news_id = news_cities.news_id
AND cities.city_id = news_cities.city_id
AND news_cities.city_id = '$id' ");
Using a lookup table like this is standard practise for SQL database design. For more information, a good tutorial on database design is available here:
http://www.webmasterbase.com/article.php/378
Bookmarks