I made this script yesterday at my home and it worked fine. And now its not working here in my job.
i'm getting this erro...
Notice: Undefined variable: conn in C:\xampp\htdocs\cef\login_sys.php on line 10
Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\cef\login_sys.php on line 10.
here is the script for login_sys.php
<?php
include 'includes/dbh.php';
$email= $_POST['email'];
$password= $_POST['password'];
$sql =("SELECT * FROM usuarios WHERE email='$email' AND
password='$password'");
$result = $conn->query($sql);
if(!$row = $result->fetch_assoc()) {
echo "Your information is invalid!! <br>
or user is not in our server = (
";
}else{
$_SESSION['id']= $row['id'];
if (isset($_SESSION['id'])){
echo $_SESSION['id'];
}else{
echo "Your not logged in";
}
//header("Location: central.php");
}
?>
here is the inclued folder with my conn variable the includes/dbh.php...
//$servername = "***";
//$username = "***";
//$password = "****";
//$dbname = "***";
//create the connection
$conn = mysqli_connect ('***', '**', '***', '***');
if(!$conn) {
die("Connection faild: ".mysqli_connect_error());
}
?>
Whats wrong?