How to get a specific record from a mysql database

i want my program to check a mysql database for a username and password stored in a table and to bring up a new window to display specific information about that user, if the user name and password in the database. I then want to displayed a window to display information about that user. The problem that i'm having is that i want to store the information to be displayed into a variable before i display it.