title: how to find the particular date data or next date data in mysql database?
body: <p>I am trying to find the particular date data from database,
  my concept is if <code>2018-11-30</code> is given to find in database if the date is present in database it should display the date in output, if not present it should add +1 date to <code>2018-11-30</code> and try to find the next date <code>2018-12-01</code> like wise it goes on.</p>
  
  <p>but i am facing the problem the date is not checked in the database.i am not sure weather my code is correct or wrong can any one give me solution for it.</p>
  
  <p>this is my code</p>
  
  <pre><code>$Firstdate = '2018-11-29';
  $Lastdate = '2018-12-03'; 
  
  $Sql2 = "SELECT ScheduleDate FROM `empdet`";
  $result2 = mysqli_query($con, $Sql2);
  
  while($row = mysqli_fetch_array($result2))
  {
      if($row["ScheduleDate"]==$Firstdate)
      {
          $DBfirstdate==$Firstdate; 
          echo "$DBfirstdatebb",$DBfirstdate;
          break;
      }
      else {
          $checkFDBdate=date('Y-m-d', strtotime("+1 day", strtotime($Firstdate)));
  
          if($row["ScheduleDate"]==$checkFDBdate)
          {
              $DBfirstdate=$checkFDBdate;
              echo "$DBfirstdate",$DBfirstdate;
              break;
          }
      }
  }
  
  
  $Sql3 = "SELECT ScheduleDate FROM `empdet`";
  $result3 = mysqli_query($con, $Sql3);
  
  while($row = mysqli_fetch_array($result3))
  {
      if($row["ScheduleDate"] == $Lastdate) {
          $DBlastdate==$Lastdate;   
          echo "$DBlastdateBB",$DBlastdate;
          break;
      }
      else {
          $checkLDBdate=date('Y-m-d', strtotime("-1 day", strtotime($Lastdate)));
  
          if($row["ScheduleDate"]==$checkLDBdate)
          {
              $DBlastdate=$checkLDBdate;
              echo "$DBlastdate",$DBlastdate;
              break;
          }
      }
  }
  
  $sql ="select * from empdet where ScheduleDate between '".$DBfirstdate."' and '".$DBlastdate."'";
  $result = $con-&gt;query($sql);
  </code></pre>