Cześć,
mam prosty skrypt logowania i taki problem, że warunek if($row = mysqli_fetch_assoc($result)) za każdym razem wynosi false, czyli wykonuje sie: "echo "Your login or password is incorrect";, nawet jak login i haslo sa poprawne
index.php:
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Home Page</title>
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="register.css">
</head>
<body>
<form class="form-contener" action="signin.php" mathod="POST">
<input type="text" class="inputText" name="username" placeholder="Your username">
<input type="password" class="inputText" name="pass" placeholder="Your password">
<button type="submit" class="inputSubmit" name="login">Sign In</button>
</form>
</body>
</html>
signin.php
<?php
$conn = new mysqli("localhost", "root", "", "register");
$username = isset($_POST['username']) ? $_POST['username'] : "";
$pass = isset($_POST['pass']) ? $_POST['pass'] : "";
$sql = "SELECT * FROM users WHERE username = '$username' AND pass = '$pass'";
$result = mysqli_query($conn, $sql);
if($row = mysqli_fetch_assoc($result)) {
echo "You are logged";
} else {
echo "Your login or password is incorrect";
}
o co moze chodzic? :_: