and error in SQL syntax
Here is the mysql error im getting:
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
Here is my code:
<?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();
}
}
?>
Someone that can help me? :) i dont know what im doing working here, cant
find the error.
No comments:
Post a Comment