title: Difficulty in Fetching data for logged in user
body: <p>Here is my login process, I want a same dashboard but data will be different for each user. But I am stuck with creating uid variables to get data for each login user.</p>
  <pre><code>if(isset($_POST['login_btn']))
  {
      $email_login=$_POST['email'];
      $password_login=$_POST['password'];
      $admin=&quot;admin&quot;;
      $co_admin=&quot;co_admin&quot;;
  
      $query = &quot;SELECT * FROM registered_users WHERE email='$email_login' AND password='$password_login' AND usertype='$admin' &quot;;
      $query_run = mysqli_query($connection, $query);
  
      $query_co = &quot;SELECT * FROM registered_users WHERE email='$email_login' AND password='$password_login' AND usertype='$co_admin' &quot;;
      $query_run_co = mysqli_query($connection, $query_co);
  
      if(mysqli_fetch_array($query_run))
      {
          $_SESSION['username'] = $email_login;
          $_SESSION['usertype'] = $admin;
          header('Location: index.php');
      }
      else if(mysqli_fetch_array($query_run_co))
          {
           $_SESSION['username'] = $email_login;
           $_SESSION['usertype'] = $co_admin;
           header('Location: company_view.php');
          }
         
      else
      {
          $_SESSION['status'] = 'Email ID / Password / User Type is Invalid';
          header('Location: login.php');
      }
  
      
  
      
  }
  </code></pre>
  <p>Above source code is for separating Co-admin and Admin. Now Any Co-Admin login to the portal he should get his own details, I would like to know which function I have to call or how should I declare a uid variable to fetch data tables for each current logged in user. I found some other source codes but which is not related to me so i am confused with how I fix it with those code. Can anyone do it in my codes.</p>