Index: tracker2.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tracker2/tracker2.module,v
retrieving revision 1.7
diff -u -p -r1.7 tracker2.module
--- tracker2.module	10 Mar 2008 16:35:35 -0000	1.7
+++ tracker2.module	10 Mar 2008 21:10:43 -0000
@@ -251,10 +251,24 @@ function tracker2_page($uid = 0) {
     $result = pager_query($sql, 25, 0, $sql_count);
   }
 
-  $rows = array();
+  // This array acts as a placeholder for the data selected later
+  // while keeping the correct order.
+  $nodes = array();
+  while ($node = db_fetch_object($result)) {
+    $nodes[$node->nid] = $node;
+  }
+
+  // Now, get the data and put into the placeholder array
+  $placeholders = implode(',', array_fill(0, count($nodes), '%d'));
+  $result = db_query("SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.nid IN ($placeholders)", array_keys($nodes));
   while ($node = db_fetch_object($result)) {
+    $nodes[$node->nid] = $node;
+  }
+
+  // Finally display the data
+  $rows = array();
+  foreach ($nodes as $node) {
     $last_updated = $node->changed;
-    $node = db_fetch_object(db_query('SELECT n.nid, n.title, n.type, n.changed, n.uid, u.name, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid WHERE n.nid = %d', $node->nid));
   
     // Determine the number of comments:
     $comments = 0;
