title: mktime() into mysql datetime column?
body: <p>I don't know if it's possible, but I'm trying to assign different dates to each user as the are entered into the database using a loop (I know that bit's possible). To do this I'm building the timestamp using mktime() but my column is datetime (for the purpose of MySQL ORDERBY timestamp DESC) and, naturally, the two don't go together. </p>
  
  <p>My code:</p>
  
  <pre><code>&lt;?php
      foreach($arr as $user_uid =&gt; $num) {
        $i = 1;
          while($num &gt; 0) {
            $i++;
            $t = new DateTime("Y-m-d H:i:s", date(mktime(0, 0, 0, $i, 1, 2012)));
            $num--;
          }
       }
  ?&gt;
  </code></pre>
  
  <p>At the moment this returns: 0000-00-00 00:00:00.</p>
  
  <p>Any help would be appreciated, thanks!</p>
  
  <p>EDIT:
  An amount has changed, my code now reads like this:</p>
  
  <pre><code>foreach($arr as $user_uid =&gt; $num) {
      $i = 1;
          while($num &gt; 0) {
              $i++;
              $t = date('Y-m-d H:i:s', mktime(0, 0, 0, $i, 1, 2012));
              $num--;
          }
  
  $game = "INSERT INTO wd_game_$gid (game_uid,user_uid,lastmove,startcountry,money) VALUES ('$gid','$user_uid',FROM_UNIXTIME('$t'),'$rand_c','$money')";
  </code></pre>
  
  <p>This now inserts: 1970-01-01 00:00:00</p>