Mysql Query Data to PHP Variable
===

So basically i have set up a login system and when you log in it displays "Welcome " and then ur username, i want to set up where it does a display name instead, so i have it all set up with the register system and stuff but i've ran into a small problem. 

I wanted it to assign the display name in the database to a varialbe

First I tried this

    $data = mysql_query("SELECT userid FROM ao_user WHERE username = '{$this->_username}' AND password = '{$this->_password}' AND display = '{$this->_display}'");

I don't know if i set that up correctly or not. Whenever i go to log in when this is set up it says invalid username/password, even though i know its right. So that makes me think that its because thats where it checks the database for the correct username and password and if i add that in since when the user logs in they dont have to type in a display name it does nothing. I could be wrong

But i decided to move on so i tried doing this


    $displaynamedata = mysql_query("SELECT userid FROM ao_user WHERE display = " . $this->_display);

The login executes but then it displays nothing for the display name.

Sorry that im terrible at explaining but hopefully someone can understand what im doing!

Thanks in advanced


EDIT: I just realized this as well but i could be wrong again, i think im executing the query backwards? Im not sure and im really confused.