Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Result page (mySQL)

Status
Not open for further replies.

shop73

IS-IT--Management
May 13, 2007
48
0
0
BA
Hello everyone,

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:

Code:
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']

Table cities
------------
cityID
cityName
cityYear
cityShow - Y - N

Table photographers
-------------------
photographerID
photographerName

Table categories
----------------
categoryID
categoryName (major city, city)

Table years
-----------
yearID
yearName

Table images
------------
imageID
imageName
imagePath
cityID

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?

Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top