# Simple SELECT FROM query

**URL:** <https://forum.kirupa.com/t/simple-select-from-query/293959>\
**Category:** Uncategorized\
**Created:** [August 6, 2009, 9:36am UTC](https://forum.kirupa.com/t/simple-select-from-query/293959 "2009-08-06T09:36:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gilbertsavier](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@gilbertsavier](https://forum.kirupa.com/u/gilbertsavier)\
**Post date:** [August 6, 2009, 9:36am UTC](https://forum.kirupa.com/t/simple-select-from-query/293959/1 "2009-08-06T09:36:01Z")

</div>

Could someone help with a simple MySQL request. I seem to be having trouble selecting from more than one field in the same table.

TABLE: User Data  
|-----------------------|  
username | password  
|-----------------------|

Code:

$result = mysql\_query ("SELECT `username` FROM `User Data`")  
or die(mysql\_error());

$row = mysql\_fetch\_row($result); // converts the result into an array

mysql\_close($link);

echo $row[0] ;

This snip of code works fine to return one value but I want to select the ‘username’ and ‘password’ columns FROM ‘user data’ WHERE ‘username’ = ‘$username’ AND ‘password’ = ‘$password’

… in one query.

the $username $password variables are delivered via query string.
