Im having trouble getting my login to work on my site.
it keeps telling me query failed, but when i echo out the username and password it matches the one on the server so i dont understand why its not working.
Im a new programmer by the way very noob.
$db = mysqli_connect($server, $user, $password, $database);
$salt = "45Gxkj9583lPMdxoekfg";
$user = $_POST['username'];
$pass = crypt($_POST['password'], $salt);
echo "<h2>welcome you are now logged in ".$user." ".$pass."</h2><br />\n";
$sql = "SELECT username, password FROM faculty WHERE username = $user AND password = $pass";
$result = mysqli_query($sql,$db) or die('Query failed: ' . mysql_error($db));
if (mysql_num_rows($result) == 1)
echo "<h2>Welcome You are now logged in.</h2>\n";
// not successful
$page = file_get_contents("err_login.html");
//$_SESSION['valid'] = 1;
//$_SESSION['user'] = $username;