I have to read data from a table until two statements are true. I dont know how to break out of the loop when I find the true statements. Here is the code:
<?php
// set-up database connection
include "db_config.php";
mysql_select_db(iceregen_MStudio);
// check for propper login from users table
$query = "SELECT UserID, UserName, password FROM users";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
if ($row['UserName'] == $LoginName AND $row['password'] == $pword)
{
echo 'username and password are valid';
}
else 'Invalid UserName and/or Password';
}
?>
I'm sure it's something simple, but i cant find the answer anywhere.
Thank you;
Ice