Jump to content

Order By Name When ID Is In Field


ASK83

Recommended Posts

Hi, I'm currently developing a message center on a site and I'm trying to make options for sorting by name or date.  The date is simple, because there is a date time stamp in my message table, but the name is a bit more complicated..  The message table only stores a user_id, which I can use joins to retrieve the name when processing and echoing, but would it work the same with the ORDER BY syntax?  And to throw a little a curve ball into the situation, there are two different message senders - users and the user's aliases (stored in another table aside from users) - so how would I go about separating and ordering the names when initially querying the message table?

Link to comment
https://forums.phpfreaks.com/topic/131315-order-by-name-when-id-is-in-field/
Share on other sites

There are two different ways the users can communicate - let's use this forum as a way to express this..  I can communicate by my login (ASK83), but let's say I was also trying to communicate to my neighbor who knows me by my first name (let's say John) - so I could send messages as my alias (ASK83) or my user (John).  If that helps any.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.