PDA

View Full Version : Order by problem


fractalbit
04-21-2003, 08:55 AM
Hi, i am trying to modify a query that exists on the yabbse forum code. The query is this :

$request = mysql_query("SELECT m.smiliesEnabled,m.posterTime,m.ID_MEMBER,m.ID_MSG,m.subject,m.body,m.ID_TOPIC,t.ID_BOARD,b.name as bname,c.name as cname,m.posterName,t.numReplies FROM {$db_prefix}messages as m,{$db_prefix}topics as t,{$db_prefix}boards as b,{$db_prefix}categories as c WHERE (m.ID_TOPIC = t.ID_TOPIC AND t.ID_BOARD = b.ID_BOARD AND b.ID_CAT=c.ID_CAT AND (FIND_IN_SET('$settings[7]',c.memberGroups)!=0 OR c.memberGroups='' OR '$settings[7]'='Administrator' OR '$settings[7]'='Global Moderator')) ORDER BY m.posterTime DESC LIMIT 0, $display");

It correctly displays the most recent $display messages starting form the most recent first. The only thing i want to change is to display those × messages but starting from the oldest. I thought it would be really simple, i just had to change the DESC to ASC right? Well it doent seem so. When i do this it displays some messages that are from february! I am clueless as why this happens. The postertime field is of bigint that stores dates getting the unix timestamp (time() function). If you have any idea how to solve this, please tell me.