Fork me on GitHub
Subscribe 1

Ticket #81 (fixed enhancement)

viewtopic.php and ORDER BY posted

  • Created: 2010-07-30 15:45:26
  • Reported by: Visman
  • Assigned to: FSX
  • Milestone: 1.4.3
  • Component: code
  • Priority: normal

Can be better to replace?

-    $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+    $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

History

Franz 2010-07-30 15:51:56

I think I talked about this with Jamie. Any chance

ORDER BY posted, id

would be the best way to go?

Visman 2010-07-30 16:01:37

What for to use together posted and id?
The order in a theme is under construction on id.

Visman 2010-07-30 16:09:47

I use such variant on PunBB 1.2:

-    $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
-    $num_posts = $db->num_rows($result);
-
-    for ($i = 0; $i < $num_posts; ++$i)
-    {
-        $cur_id = $db->result($result, $i);
-        if ($cur_id == $pid)
-            break;
-    }
-    ++$i; // we started at 0
-
-    $_GET['p'] = ceil($i / $pun_user['disp_posts']);

+    $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND id<'.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
+    $i = $db->result($result);
+    ++$i;
+    $_GET['p'] = ceil($i / $pun_user['disp_posts']);

Reines 2010-08-06 23:43:15

  • Milestone set to 1.4.2.

Reines 2010-08-09 12:30:18

  • Milestone changed from 1.4.2 to 1.4.3.

FSX 2010-08-09 14:17:50

  • Status changed from open to fixed.

Reines 2010-08-09 14:23:21

  • Owner set to FSX.

Page (v1.5:caching) edited by Franz 2013-03-17 16:15:52

#812: Created cache page

Page (v1.4:caching) edited by Studio384 2013-03-17 18:53:50

#812: Copy Franz's cache page for 1.4

Page (v1.4) edited by Studio384 2013-03-17 18:54:14

#812: FIXME remove for Cache

Page (v1.5) edited by Studio384 2013-03-17 18:54:25

#812: FIXME remove for Cache