这是我得到的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();
}
}
?>
有人可以帮助我吗?:) 我不知道我在这里做什么,找不到错误。