INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Result page (mySQL)

Result page (mySQL)

(OP)
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    

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close