Hi Guys,
I'm having a few issues, I have managed yo let users register this works fine. But When the registerd user tries to log into the site I'm getting the following error message
Warning: mysqli_query() expects at least 2 parameters, 1 given in C:\xampp\htdocs\login.php on line 16
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\login.php on line 16
This is my code
<?php
// 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['username'];
$password = $_POST['password'];
// Do some basic sanitizing
$username = stripslashes($username);
$password = stripslashes($password);
$sqli = "select * from 'users' where username = '$username' and password = '$password'";
$result = mysqli_query($sqli) or die ( mysqli_error() );
$count = 0;
while ($line = mysqli_fetch_assoc($result)) {
$count++;
}
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
}
?>
Any ideas? All help is much appreicated