25 Nov 09 19:04
I made two pages (Search and Result). I've created a database with five tables (cities, categories, images, photographers and years). I used two parameters from search page (categoryID and photographerID). On the results page, I made the following query:
SELECT cities.cityID, cities.cityName, categories.categoryID, categories.categoryName, photographer.photographerID, photographer.photographerName, cities.description, years.yearName, images.imageID, images.imageName, images.imagePath
FROM cities, categories, phofographers, years, images
WHERE cities.categoryID = categories.categoryID AND cities.photographerID = photographers.photographerID AND cities.yearID = years.yearID AND categories.categoryID = colname1 AND photographers.photographerID = colname AND images.cityID=cities.cityID AND images.imageID IN (SELECT MIN(imageID) as tmp FROM images
GROUP BY cityID)
ORDER BY cities.cityName ASC
colname = colname, numeric, -1, $_GET['photographer']
colname1= colname1,numeric, -1, $_GET['category']
cityShow - Y - N
categoryName (major city, city)
I wanted to get, depending on the url parameter, results that will show all cities (major cities or cities from certain photographers) and only one image for the city. Each photographers can have multiple pictures of the same city but i need to show only one image from multiple pictures on the master page. On the detail page I will to show all the images.
This query is wrong!Does not show all cities on the result page. Can You help me?