title: login on update user role but not going on redirected or set pages if query matched
body: <h1>I have two table</h1>
  
  <p>1] Signup_users [first name , email_id , password , user_role]</p>
  
  <p>2] add_business [name, email,address,phone,location]</p>
  
  <p>what i need is when user login ,if <strong>Email id</strong> is matched with <strong>two tables</strong> , update <strong>user_role</strong> is <strong>'customer'</strong> else if not matched with both a table update as a <strong>'user'</strong> ,</p>
  
  <p>but what happening in my case , **</p>
  
  <blockquote>
    <p>it's all working i can login and user_role is updated, but not working redirecting pages as per login , for that i need to logout then again login then it's work well .</p>
  </blockquote>
  
  <p>so what i want if i login same time update the user_role and same time if query matched go to defined page as per user_role ,but redirecting pages working when i logout and login again then it's work.please look for last <strong>update</strong> query
  <strong>Please Help</strong></p>
  
  <p>sorry for english if not get it to you.</p>
  
  <pre><code>&lt;?php  include ('../database_connection/db_connection.php'); ?&gt;
  &lt;?php session_start(); ?&gt;
  
  &lt;?php
  
  //Log in SCRIPT for User Sign in
  
  if(isset($_POST['login_submit'])){
  
  $email_username =  $_POST['sign_in_email'];
  $password = $_POST['sign_in_password'];
  
  $email_username = mysqli_real_escape_string($connection,$email_username);
  $password = mysqli_real_escape_string ($connection,$password);
  
  $username_get = "SELECT * FROM signup_users WHERE email_id = '{$email_username}'";
  $username_connection = mysqli_query($connection,$username_get);
  
  if(!$username_connection){
  die("MYSQLI_ERROR". mysqli_error($connection));
   }
  
  
  
  
  while($row = mysqli_fetch_array($username_connection)){
  
  $db_user_id = $row['user_id'];
  $db_full_name = $row['full_name'];
  $db_email_id = $row['email_id'];
  $db_password = $row['password'];
  $db_user_role = $row['user_role'];
  
  }
  if($email_username !== $db_email_id &amp;&amp; $password !== $db_password)
  {
     header("LOCATION: index.php");
  }
    else if($email_username == $db_email_id &amp;&amp; $password == $db_password  &amp;&amp;  $db_user_role == 'customer'){
  
  $_SESSION['user_id'] = $db_user_id; 
  $_SESSION['full_name'] = $db_full_name; 
  $_SESSION['email_id'] = $db_email_id; 
  $_SESSION['password'] = $db_password; 
      $_SESSION['user_role'] = $db_user_role;
  
   header("LOCATION: ../dashboard/dashboard_overview.php");
  
  }
  else {
  header("LOCATION: index.php");
  }
  
  $select_two_tables_email = "SELECT signup_users.email_id  , addbusiness.email  FROM signup_users inner join addbusiness on  signup_users.email_id = addbusiness.email AND signup_users.email_id = '{$email_username}' AND addbusiness.email = '{$email_username}'  ";
  $select_two_table_query = mysqli_query($connection,$select_two_tables_email);
  
  
  if(mysqli_num_rows($select_two_table_query) == $select_two_table_query)
  {
  
  $update_query_email  = "UPDATE signup_users SET user_role = 'customer' WHERE  email_id = '{$email_username}' ";
  $select_query_mysqli = mysqli_query($connection,$update_query_email);
           }
  else if(mysqli_num_rows($select_two_table_query)!== $select_two_table_query){
  $update_query_email_id  = "UPDATE signup_users SET user_role = 'user' WHERE  email_id = '{$email_username}' ";
  $select_query_mysqli = mysqli_query($connection,$update_query_email_id);
  
  }
  else{
  $update_query_email_blank  = "UPDATE signup_users SET user_role = 'blank' WHERE  email_id = '{$email_username}' ";
  $select_query_blank = mysqli_query($connection,$update_query_email_blank);
  
  }  
  
  
  } 
  
  
  
  ?&gt;
  </code></pre>