How to join two table in mysqli using php : how to join two table in mysqli using php 
i have two table 1st is checkin and 2nd is checkout and i am trying to merge two table with condition please help me to fix this issue 

here is my table structure

    checkin 
    
    userid currentdate currenttime
    60     08-03-2018   03:10
    60     08-03-2018   05:50
    60     08-03-2018   08:20
    20     08-03-2018   01:04
    60     09-03-2018   11:23
    20     09-03-2018   10:24

    checkout
    
    userid currentdate currenttime
    60     08-03-2018   04:05
    60     08-03-2018   06:10
    60     08-03-2018   09:25
    20     08-03-2018   07:30
    60     09-03-2018   12:30
 

i want result like this

    Result
    
    Userid Date        Time
    60     08-03-2018   In:03:10  Out:04:05
                        In:05:50  Out:06:10
                        In:08:20  Out:09:25
    20     08-03-2018   In:01:04  Out:07:30
    60     09-03-2018   In:11:23  Out:12:30
    20     09-03-2018   In:10:24    


   



here is the php code


 

    <?php
        include 'db.php';
        
        
           $sql = 'SELECT checkin.iduser as iduser,checkin.currentdate as currentdate, checkin.currenttime as currenttime, checkout.iduser as iduser2 , checkout.currentdate as currentdate2, checkout.currenttime as  currenttime2 FROM checkin LEFT JOIN checkout ON checkin.iduser = checkout.iduser';
           
           if($result = mysqli_query($con, $sql)) {
              if(mysqli_num_rows($result) > 0) {
                 echo "  <table class=\"table table-bordered\">";
                 echo "<tr>";
                 echo "<th>ID</th>";
                 echo "<th>Date</th>";
                 echo "<th>Time</th>";
                 echo "</tr>";
                 
                 while($row = mysqli_fetch_array($result)){
                    echo "<tr>";
                    echo "<td>" . $row['iduser'] . "</td>";
        	    echo "<td>" . $row['currentdate'] . "</td>";
                    echo "<td>In :" . $row['currenttime'] . " <br> Out:" . $row['currenttime2'] . "</td>";
        
                    echo "</tr>";
                 }
                 echo "</table>";
                 mysqli_free_result($result);
              } else {
                 echo "No records matching your query were found.";
              }
           } else {
              echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
           }
           mysqli_close($con);
        ?>