I have created a login so that a user can log into a site, I am using php and phphmyadmin to create the login, i used the same code for another project I am doing and it worked fine but it won't work now and doesn't seem to like line 15, what am I doing wrong.
Here is my code
<?php
session_start();
?>
<header id="page_header">
<?php
include "connect.php";
if (isset($_POST['username']) and isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='$username' and password='$password'";
$result = mysqli_query($con, $query) or die(mysqli_error());
$count = mysqli_num_rows($result);
if ($count == 1){
$_SESSION['username'] = $username;
}else {
echo "Invalid Login Credentials.";
}
}
?>
<div id = "menu">
<nav>
<ul>
<li><img src="../img/buzz_party.png"></li>
<li><a href="index.php">Home</a></li>
<li><a href="aboutus.php">About Us</a></li>
<li><a href="advertising.php">Supplies</a></li>
<li><a href="items.php">Party Supplies</a></li>
<li><a href="contact.php">Contact Us</a></li>
</nav>
</div>
<div id = "login_details">
<?php
if (isset($_SESSION['username'])){
$username = $_SESSION['username'];
echo "Hello " . $username . " ";
}
echo "<a href='logout.php'>Logout</a>";
?>
</div>
<div id="login">
<form action="index.php" method="post">
<label for="username" class="uname" data-icon="u" >Username:</label>
<input id="username" name="username" required="required" type="text" size="10" placeholder="Username"/>
<label for="password" class="youpasswd" data-icon="p">Password:</label>
<input id="password" name="password" required="required" type="password" size="10" placeholder="Password" />
<input type="submit" value="Login" />
</form>
</div>
</header>