For example, lets say I have a database coontaining 2 kinds of images: cars and boats. I want to display 2 buttons on the page:
one called CARS and
the other called BOATS.
When you click on the CARS button I want the sql statment "SELECT * FROM CARS" to execute. Likewise, when you click on the BOATS button I want the sql statment "SELECT * FROM BOATS" to execute. I have no problem, at this point displaying the images.The problem is attaching the sql execution to the various buttons.

I would appreciate any help on this.

NOTE: Thanks again to all of you that have helped me already.