Ok, Ive tried searching the forum to no avail. Everything returned didnt really help me understand anythign clearly. So im gonna ask directly.
Well, I have a MySQL database called Users, withinh it there is a table called userinfo. The two main fields im interested in are username and password. Ok, understand? brilliant! moving on.
What I want is a script that checks the input username and password from the form against those in the database. Then when it finds an entry checks the password nagainst the username.
The script which I have written looks like this:
Note, this isnt the ACTUAL script as it is at home and i am not, but I think this is what it looks roughly like, excuse any parse errors as i am a newbie!
$dbhost = "localhost";
$dbuser = "root";
$dbpass = "";
//Connect to MySQL server
$db = mysql_connect($dbhost, $dbuser, $dbpass);
//Select the database to use
mysql_select (users);
$query = "SELECT * FROM userinfo";
$result = "mysql_query($query)";
$row = "mysql_fetch_array($result)";
//This is where I get lost!
//Im not sure how to preform the login check!
//I thought about using a while loop??
//Please bear in mind that this may not be corrcetly written here but on the actual script it is.
while ($row = mysql_fetch_array($result)) {
if (($row[username] == $input_username) && ($row[password] == $input_password)) {
echo ("Successful login!");
//Code for transfer insert here
} else {
echo ("Incorrect login details");
}
}
HELP?!?!