Here is my code I can't get the if statement to work, if name does not exist it reads "Record found" and the page3.php says Passwords do not match can someone please help me with this Thank you
<?php
session_start();
//$_SESSION["authorized"]=0;
$name = $_POST["name"];
$pass = ($_POST["password"]);
$connect = mysql_connect("localhost","tina","tinapassword") or die("Could not connect");
$selected = mysql_select_db("tinadatabase", $connect) or die("Could not connect to database");
$query = "SELECT * FROM users WHERE Uname='$name'";
$result = mysql_query($query, $connect);
$row = mysql_fetch_assoc($result);
if ($result)
{
//$row ==1;
print "Record found";
}
else
{
//$row == 0;
print "Record not found";
}
print "<br>";
md5($pass);
if($name == $result["Uname"] && md5('$pass') == $result["Upassword"])
{
$_SESSION["authorized"] = 1;
}
else
{
$_SESSION["authorized"] = 0;
}
print "<br>";
print"<a href='page3.php'> continue</a>";
?>