title: Foreach time loop not working
body: <p>There are a few parts to this code. The first part is creating fixtures.</p>
  
  <pre><code>$totalRounds = $teams - 1;
      $matchesPerRound = $teams / 2;
      $rounds = array();
      $roundDates = array();
      $curTime = time();
  
      for ($i = 0; $i &lt; $totalRounds; $i++) {
          $rounds[$i] = array();
          $numDays = $i * 4;
          $roundDates[$i] = strtotime("+".$numDays." days",$curTime);
  
      }
  
      foreach($roundDates as $time) {
          for ($round = 0; $round &lt; $totalRounds; $round++) {
              for ($match = 0; $match &lt; $matchesPerRound; $match++) {
                  $home = ($round + $match) % ($teams - 1);
                  $away = ($teams - 1 - $match + $round) % ($teams - 1);
                  // Last team stays in the same place while the others
                  // rotate around it.
                  if ($match == 0) {
                      $away = $teams - 1;
                  }
  
                  $rounds[$round][$match] = "$user[$home]~$team[$home]@$user[$away]~$team[$away]~$time";
              }
          }
      }
  </code></pre>
  
  <p>In the above code, a time is made for each round of fixtures.
  At the end of the code I have added $time. </p>
  
  <pre><code>        for ($i = 0; $i &lt; count($rounds); $i++)
      {
          foreach ($rounds[$i] as $r)
          {
              $seperateUsers = explode("@",$r);
              $homeinfo = $seperateUsers[0];
              $awayinfo = $seperateUsers[1];
              $homedetails = explode("~",$homeinfo);
              $awaydetails = explode("~",$awayinfo);
              $database-&gt;addFixtures($homedetails[0], $homedetails[1], $awaydetails[0], $awaydetails[1], $awaydetails[2]);
          }   
      }
  </code></pre>
  
  <p>This piece of code uses breaks down the code from above to put into the table. For some reason, the date that is being entered into the database comes out 0000-00-00 00:00:00.</p>
  
  <p>Is there anything anyone can see to fix this?</p>
  
  <p>Edit: the loop isnt working?
  Am i missing anything on the actual loop?</p>