title: JSON response is not ordering properly according to SQL query
body: <p>I'm having a problem with my JSON array. On first load, the order is not as it should be (as defined in the SQL query).</p>
  
  <p>So the main problem is, on page load, i.e. when the SQL query is called with lastPoll=null - the results are not sorted by time1 DESC, yet they are sorted by the s.id ASC. When I enter a new result, and then run the query with the lastPoll set in the query, then the latest is added to the top, as it should be. </p>
  
  <p>Weird part is - if I view the raw JSON response at push.php with the correct params in the URL, the response is correct and in the correct order. So, the problem must lie in the parsing?</p>
  
  <p>Here is the SQL Query:</p>
  
  <pre><code>$getActivityUpdates1 = mysql_query("
      SELECT
          s.id, u.name, u.profilePic, s.userid,  s.content, s.time1, s.imageKey
      FROM
          status_updates s 
      INNER JOIN
          users1 u ON u.id = s.userid 
      WHERE
          competitionId = '$competitionId' AND s.time1 &gt; '$lastPoll'
      ORDER BY s.time1 DESC");
  
  $results = array('items' =&gt; array());
  
  while ($row = mysql_fetch_array($getActivityUpdates1)) 
  {
      $results['items'][] = array(
      'statusid' =&gt; $row['id'],
      'name' =&gt; $row['name'], 
      'profilePic' =&gt; $row['profilePic'],
      'content' =&gt; $row['content'],
      'time1' =&gt; $row['time1'],
      'imageKey' =&gt; $row['imageKey'],
      );
  }
  
  die(json_encode($results));
  ?&gt;
  </code></pre>
  
  <p>Here is the Javascript where I re-run the query. </p>
  
  <pre><code>var lastPoll = null;     
  function loadActivity(onDone) {
  
      var competitionId = $("body").attr("data-competitionId");
      console.log(lastPoll);
  
      if (lastPoll == null) { // We have never polled, we want to pull everything and populate  the list.
          url = "push.php?competitionId=" + competitionId + "&amp;lastPoll=1999-01-01 22:00:00"; 
      } else { // We have polled once, send the date and time of that last poll to capture only new entries.
          url = "push.php?competitionId=" + competitionId + "&amp;lastPoll=" + lastPoll;   
      }
  
      $.get(url, function(data) {
          jsonData = $.parseJSON(data);
  
          var spot = $("#activityspot");
          var template = spot.find(".template");
  
          for (var j = 0; j &lt; jsonData.items.length; j++) {
              var entryData = jsonData.items[j];
              var entry = template.clone();
              entry.removeClass("template");
  
              entry.find(".message").text(entryData.statusid);
              spot.prepend(entry);
          }
  
          if (onDone) {
              onDone();
          }
  
          lastPoll = js_yyyy_mm_dd_hh_mm_ss();
  
      });
  }
  </code></pre>