simple SELECT FROM query
gilbertsavier
Status: Interested
Joined: 28 Jun 2009
Posts: 12
Reply Quote
Hi,
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.
Back to top
Display posts from previous:   

All times are GMT - 8 Hours