It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

simple SELECT FROM query

Moderator: Malcolm

simple SELECT FROM query

Postby gilbertsavier on Wed Aug 19, 2009 1:13 pm

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.
gilbertsavier
 
Posts: 24
Joined: Fri Jun 26, 2009 11:34 am

Who is online

Users browsing this forum: No registered users and 1 guest