Uutiset:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu
Advertisement:

What is the field "id_last_msg" in smf_topics?

Aloittaja bobdole2281, syyskuu 06, 2013, 10:32:33 AP

« edellinen - seuraava »

bobdole2281

I'm trying to understand what the field id_last_msg is on the table smf_topics.

Here is an example:

id_last_msg
2878
150
...

Does that represent the ID of a post or some kind of time period when the post was made?

Arantor

Shock horror... maybe it's the id of the last message in the topic as referencing smf_messages...?
Holder of controversial views, all of which my own.


margarett

Trying to be a little more specific...

All your posts are stored in the table "smf_messages". The topics (the post that starts a topic) are referenced in the table "smf_topics" (not the post itself, kind of a "pointer" to the post in). In each topic you have a "last post", whose ID is pointed out in that field. Easy, right? ;)

If I might ask, what are you trying to do? Or just navigating the DB?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Colin

It is used to quickly display the last message of the thread on the board index and thread index. It also is used for the last message link.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Arantor

It's used for more than that, too. It's actually used to calculate whether a topic has unread messages or not.
Holder of controversial views, all of which my own.


bobdole2281

Lainaus käyttäjältä: margarett - syyskuu 06, 2013, 10:58:40 AP
Trying to be a little more specific...

All your posts are stored in the table "smf_messages". The topics (the post that starts a topic) are referenced in the table "smf_topics" (not the post itself, kind of a "pointer" to the post in). In each topic you have a "last post", whose ID is pointed out in that field. Easy, right? ;)

If I might ask, what are you trying to do? Or just navigating the DB?

I found what I was looking for.

Just trying to better understand. It definitely wasn't what I thought. It does a lot more than I thought as well.

Thanks for the replies guys.

Arantor

I'm not being funny but what did you think it might be?

The columns are, by and large, well named. If you have something in the topics table that's called 'id_last_msg', is it not totally logical it should be the id of the last message in the topic? Just as id_first_msg is the id of the first message in the topic... just as num_replies is the number of replies in the topic.
Holder of controversial views, all of which my own.


bobdole2281

I wasn't sure if each message had it's own ID. I assumed that's what it was, but I found it strange there was no poster_time like in the smf_messages.

Now I know though, learning new stuff everyday.

Arantor

Why would the topic have a poster time? The topic has a collection of messages, there's no way a single poster time would work for it?

The topic is a collection of messages, the messages have times. smf_messages does quite clearly have an id, id_msg.
Holder of controversial views, all of which my own.


Advertisement: