title: Query missing result If I use Php but is complete if I run in Mysql
body: <p>I have a query to get users and attendance of users on a span of date as shown below</p>
  
  <pre><code>select 
     u.user_id,
     u.username,
     min(case when a.action = 'IN' then date(a.server_time) end) `Date`,
     min(case when a.action = 'IN' then time(a.server_time) end) `IN`,
     max(case when a.action = 'OUT' then time(a.server_time) end) `OUT`
  from 
     users u
     inner join user_attendance a on u.user_id = a.user_id AND  (a.server_time BETWEEN '2019-10-01 00:00:00' AND '2019-10-15 23:59:59')
  group by
     u.user_id,
     u.username,
     date(a.server_time)
  order by
     u.user_id,
     date(a.server_time)
  </code></pre>
  
  <p>If I run the query above in Mysql it will return a correct data as show below</p>
  
  <p><a href="https://i.stack.imgur.com/vSBgJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vSBgJ.png" alt="enter image description here"></a></p>
  
  <p>But when I Run it with Php using the code below</p>
  
  <pre><code>&lt;?php
      $servername = "localhost";
      $username = "root";
      $password = "";
      $dbname = "lumenapi";
  
      // Create connection
      $conn = mysqli_connect($servername, $username, $password, $dbname);
      // Check connection
      if (!$conn) {
          die("Connection failed: " . mysqli_connect_error());
      }
  
      $dailyDate = date("Y-m-d");
  
      $sql = "select 
                  u.user_id,
                  u.username,
                  min(case when a.action = 'IN' then date(a.server_time) end) `Date`,
                  min(case when a.action = 'IN' then time(a.server_time) end) `IN`,
                  max(case when a.action = 'OUT' then time(a.server_time) end) `OUT`
              from 
                  users u
                  inner join user_attendance a on u.user_id = a.user_id AND  (a.server_time BETWEEN '2019-10-01 00:00:00' AND '2019-10-15 23:59:59')
              group by
                  u.user_id,
                  u.username,
                  date(a.server_time)
              order by
                  u.user_id,
                  date(a.server_time)";
      $result = mysqli_query($conn, $sql);
  
      if (mysqli_num_rows($result) &gt; 0) {
          // output data of each row
          while($row = mysqli_fetch_assoc($result)) {
              echo "id: " . $row["user_id"]. " - Name: " . $row["username"]. " -Date: " .$row["Date"]. "&lt;br&gt;";
          }
      } else {
          echo "0 results";
      }
  
      mysqli_close($conn);
      ?&gt;
  </code></pre>
  
  <p>it will return to me the result below and as you can see, the result is different from the one I run in Mysql directly</p>
  
  <p><a href="https://i.stack.imgur.com/qiPJC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qiPJC.png" alt="enter image description here"></a></p>
  
  <p>disregard the columns just focus on the number of results and the date, mysql returns 2,7,9,10,15 for October but returns NULL, 10 and 15 only if I use the Php code.</p>
  
  <p>Please help, I'm stuck here.</p>