query sql and get result for foreign key's value(not id)

Grajek-X56

New Member
If I have one table:
  • IMAGES with columns imageID, Image, and categoryID*(this being the foreign key)
and 2nd table
  • CATEGORIES with columns categoryID, Category
and peform query for example: $sql = "SELECT categoryID FROM IMAGES WHERE image = 'exampleImage'";I would get the result as an integer of the category ID i.e 1My question is what would be the query to display the category that the ID belongs to? Or any suggestions on how to work around with multiple queries.
 
Back
Top