Due to circumstances after years I have too make a site in PHP. But I am a bit lost! Right now I am working on a gallery page that exists of different galleries e.a. general, food, restaurant etc. To accomplish this I have two tables in the database involved galleries and gallery_photos:
Code:
CREATE TABLE IF NOT EXISTS `galleries` (
  `gallery_id` smallint(2) NOT NULL auto_increment,
  `gallery` varchar(128) NOT NULL,
  PRIMARY KEY  (`gallery_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `gallery_photos` (
  `photo_id` smallint(2) unsigned NOT NULL auto_increment,
  `gallery_id` smallint(2) NOT NULL,
  `photo` varchar(255) NOT NULL,
  `description_dut` varchar(255) default NULL,
  PRIMARY KEY  (`photo_id`),
  FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`gallery_id`) ON DELETE CASCADE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
On the gallery page I have on the left the gallery and on the right a menu with the different galleries. I am looking for a way that when you land on the gallery page all photos are there but when you click on one of the menu items only the photos from that gallery are displayed. In the scripting language I normally use (Coldfusion) I could do something like this within the query:
Code:
 <cfif structKeyExists( URL, "gallery_id" )>
WHERE
               gallery_id = URL.gallery_id
</cfif>
How would I do that in PHP?

Thank you in advance.