PDA

View Full Version : private messages counter


Wordplay
11-08-2004, 07:59 AM
can i get a count for the number of private messages for each individual user? displayed directly underneath the number of posts hes made?

Andreas
11-08-2004, 09:28 AM
If you just want that for the current PMs it is pretty simple.

For all PMs (sent and received):
select count(*) from PM where userid=1234

For sent PMs
select count(*) from PM where userid=1234 and folderid=-1

For received PMs
select count(*) from PM where userid=1234 and folderid!=-1

If you want a real counter you would have to create a new int field in table user or userfield and increment that whenever the user receives or sends a pm.

Wordplay
11-08-2004, 07:52 PM
how would i increment that whenever a user recieves or sends a pm?

Link14716
11-08-2004, 07:57 PM
If you just want that for the current PMs it is pretty simple.

For all PMs (sent and received):
select count(*) from PM where userid=1234

For sent PMs
select count(*) from PM where userid=1234 and folderid=-1

For received PMs
select count(*) from PM where userid=1234 and folderid!=-1

If you want a real counter you would have to create a new int field in table user or userfield and increment that whenever the user receives or sends a pm.
Unless you want to add a query per post, I wouldn't do that.

Andreas
11-08-2004, 08:05 PM
Not per post - per user ;)
You're right, I wouldn't do that either.

Wordplay
11-09-2004, 08:10 AM
of course, i got that much. my question is>

If you want a real counter you would have to create a new int field in table user or userfield and increment that whenever the user receives or sends a pm.

if i just run the query, that wouldn't include the private messages count anywhere in the profile... would it? i need to include that somewhere in a profile field. how do i do that?

sorry i'm practically eliterate with this kind of stuff.

Wordplay
11-16-2004, 10:45 AM
anybody out there?