well im assuming you can do the querying if not here
SELECT * FROM tbl_name WHERE feild='$feild'");
thats just simple.. just change that to what it needs to be..
then from there your wanting thumbs
i do this really easy.. im so lazy..
we do the while loop
echo"<a href=/have a pop script here/?id=$id><img src=path/to/images width=90 height=90></a>
Like i said i do it the easy way.. I assume you have some basic Javascript knowledge for the POP UP Window