I am working with PHP version 7.0.4..I wrote the code to store users' sessions.but it shows the below error:
Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\PCzone\login.php on line 136
The code is:
<?php
$user_name = $_SESSION['user_name'] = $_POST['user_name'];
$user_pass = $_POST['user_pass']
if(isset($_POST['login'])){
$query = "SELECT * FROM `login` WHERE user_name='$user_name' AND user_pass='$user_pass'";
$run = mysqli_query($con,$query);
if(mysqli_num_rows($run)>0){
header("location:view_posts.php");
}
else{
echo "<center><div style='margin-top:8px; width:350px; height:60px; line-height:60px; border:3px solid red; background:rgb(255,145,138); font-family:calibri;'>Login failed, user name or password is incorrect</div></center>";
exit();
}
}
?>