title: PHP echoing an amended list from database
body: <p>Trying to make a script so dates added by form to a mysql database are checked against a list of dates between a start date and an end date. If the dates conflict they will be removed from the start date to end date list leaving no conflicts. This is what I have so far: </p>
  
  <p>`</p>
  
  <pre><code>$date1 = '10/06/2014';
  $date2 = '30/06/2014';
  
  function returnDates($fromdate, $todate) {
   $fromdate = \DateTime::createFromFormat('d/m/Y', $fromdate);
      $todate = \DateTime::createFromFormat('d/m/Y', $todate);
      return new \DatePeriod(
    $fromdate,
    new \DateInterval('P1D'),
    $todate-&gt;modify('+1 day')
  );
  }
  
  $datePeriod = returnDates($date1, $date2);
  foreach($datePeriod as $date) {
       $possible=$date-&gt;format('dmY');
  }`
  $con=mysqli_connect("localhost","user","pass","table");
  // Check connection
  if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  
  $result = mysqli_query($con,"SELECT * FROM events");
  
  while($row = mysqli_fetch_array($result)) {
    $dateday = $row['Day'];
    $datemonth = $row['Month'];
    $dateyear = $row['Year'];
  
    if($datemonth&lt;"12"){
    $newmonthdate=("0$datemonth");
    }else{
    $newmonthdate=("$datemonth");
     }
  
     $taken="$dateday$newmonthdate$dateyear";
  }
  
      if( $taken=$possible){
  echo $taken;
  </code></pre>
  
  <p>the last bit is the part I'm stuck on, getting it to print out a the list of dates from the start date to the end date which don't contain the dates from the mysql database. At the moment I have the dates in the format of 23062014. (New to this so I feel I have made this more complicated than it needs to be) Thanks if you can help </p>