i have problem with my Blog site project. Before go to the topic, just for information my english is really bad, so i'm sorry if you cannot understand what i'm saying xD
This is my Front End login panel Click Here to view, And this is my checklogin.php script :
include('connection.php');
error_reporting(0);
session_start();
$username = $_POST['username'];
$password = md5 ($_POST['password']);
$query = mysqli_query("SELECT * from users where username ='$username' and password ='$password'");
$data = mysqli_fetch_array($query);
$ada = mysqli_num_rows($query);
if ($password == $data['password']){
$_SESSION['user'] = $data['username'];
$_SESSION['level'] = $data['level'];
$_SESSION['nama'] = $data['nama'];
$_SESSION['jabatan'] = $data['jabatan'];
$_SESSION['pic'] = $data['pic'];
session_register("username");
session_register("password");
echo "<meta http-equiv='refresh' content='0; URL=loading.php'>";
}
else
echo "Wrong Username or Password!!!
<meta http-equiv='refresh' content='0; URL=login.php'>";
Then this is my connection.php script :
mysqli_connect('localhost', 'root', '', 'masjid');
//mysqli_select_db("masjid");
And this is the problem, when i'm trying to login with user and password from database (example : username = admin, password = 12345), it's redirecting to checklogin.php and i got message like this Click Here to view, and the table structure Click Here to view. For some reason i think it's problem with mysqli_connect or mysql_query but i didn't get it, so please help and what i need to do?
Thanks