I figured out the second part of my last post.
I added where id = $photo into the query. $photo is defined in the URL. index-test.php?link=web&photo=5
PHP Code:
$query = "SELECT id, title, description, path, image, date FROM photos WHERE id = $photo";
That allowed me to view the picture with id = 5.
I'm still stumped on the first part of my last post though.