Hey guys hope your all well!

I just need some help on my login script I found some simple script and I'm getting the following error message now when I try and get users to log in

Notice: Undefined index: user in C:\xampp\htdocs\login.php on line 7
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 ''users' where username = '' and password = 'password'' at line 1

This is the Login.php script

// checkLogin.php

session_start(); // Start a new session
require('config.php'); // Holds all of our database connection information
// Get the data passed from the form
$username = $_POST['user'];
$password = $_POST['password'];

// Do some basic sanitizing
$username = stripslashes($username);
$password = stripslashes($password);

$sql = "select * from 'users' where username = '$username' and password = '$password'";

$result = mysql_query($sql) or die ( mysql_error() );
$count = 0;
while ($line = mysql_fetch_assoc($result)) {

if ($count == 1) {

     $_SESSION['loggedIn'] = "true";

     header("Location: loginSuccess.php"); // This is wherever you want to redirect the user to

} else {

     $_SESSION['loggedIn'] = "false";

     header("Location: loginFailed.php"); // Wherever you want the user to go when they fail the login


This is the config.php code


$connection = mysqli_connect("localhost","root","","registration");

// Check connection
if (mysqli_connect_errno())
  echo "Failed to connect to MySQL: " . mysqli_connect_error();

Hope someone can help me out with this