-1

mysqlエラーは次のとおりです。

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECY * FORM user WHERE username='' AND password='' LIMIT 1' at line 1

これが私のコードです:

<?php
session_start();
include_once("connect.php");

if (isset($_POST['username'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $sql = "SELECY * FORM users WHERE username='".$username."' AND password='".$password."' LIMIT 1";
    $res = mysql_query($sql) or die(mysql_error());
    if (mysql_num_rows($res) == 1) {
        $row = mysql_fetch_assoc($res);
        $_SESSION['uid'] = $row ['id'];
        $_SESSION['username'] = $row ['username'];
        header("Location: index.php");
        exit();
    } else {    
        echo "Invalid login information. Please return to the previous page.";
        exit();
    }
}
?>

私を助けることができる誰か?:)ここで何をしているのかわかりません。エラーが見つかりません。

4

2 に答える 2