title: I need to fetch the data from mysql database using the employee id from the table
body: <p>I need to fetch the data from the table using the employee id,</p>
  
  <p>there are two tables</p>
  
  <p>1."user_info" which contains    id, name,password,email,ScheduleDate,etc!</p>
  
  <p>2."fetch" which contains id,ScheduleDate,starttime,endtime,hours,employeeid.</p>
  
  <p>if i give the name and the password it takes the id of the particular user from "user_info" and it should send the id as the employee id to the table "fetch" and it should fetch the data from that employee id.</p>
  
  <p>User_info database </p>
  
  <p><a href="https://i.stack.imgur.com/hgqfZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hgqfZ.png" alt="enter image description here"></a></p>
  
  <p>fetch database</p>
  
  <p><a href="https://i.stack.imgur.com/kJxWv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kJxWv.png" alt="enter image description here"></a></p>
  
  <p>for example if i give the input as name :rajesh password:1995 in user_info,it should take the id of this user and it should send the id as employee id as 15 to the "fetch" table.</p>
  
  <p>when i tried to send the id as employee id it doesn't print anything,and didn't show any error.</p>
  
  <pre><code>           &lt;?php
       require "init.php";
       $name = "surya";
       $password = "1995";
          $Sql = "SELECT * FROM `user_info` 
          WHERE `name`='".$name."' AND 
          `password`='".$password."';";
  
  $result = mysqli_query($con, $Sql);
  $retrive = array();
  
  while($row = mysqli_fetch_array($result))
  {
      $user_id =  $row['id']; 
  
  
  
      $sql = "SELECT id, ScheduleDate, StartTime,Endtime, Hours,Employeeid 
      FROM empdet WHERE Employeeid ='".$user_id."' ";
  $result = $con-&gt;query($sql);
  
  if ($result-&gt;num_rows &gt; 0) 
  {
      // output data of each row
      while($row = $result-&gt;fetch_assoc()) 
      {
          $id=$row["id"]. 
          $date=$row["ScheduleDate"]; 
          $start=$row["StartTime"]; 
          $end=$row["Endtime"];
          $hour=$row["Hours"];
          $Employeeid=$row["Employeeid"];
          list($year,$month,$day) = split("-",$date);
          $data[] = array("year"=&gt;$year,
                         "month"=&gt;$month,
                         "day"=&gt;$day,
                         "StartTime"=&gt;$start,
                         "Endtime"=&gt;$end,
                         "Hours"=&gt;$hour );
  
      } 
      $response = $data;
  } else 
  {
      echo "0 results";
  }
  
  }
  
  echo json_encode(array("user_data"=&gt; $response)); 
  
     ?&gt;
  </code></pre>
  
  <p>i need to fetch all the 3 data from the "fetch" table using the employee id 15.can anyone help to find it out this?</p>