General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 21st, 2002, 09:15 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
page has been viewed?

I am wondering how to go about checking if a PM has been read by the user.

what I am trying to accomplish is pretty much the same as what these forums, and many other forums, do. If the PM has been read by the user, it changes the icon to mark that it has been read, etc, etc.

The other thing I am trying to accomplish is, I am allowing users to reply to each others PM's,...I want it to act like a message board, in that, if the user has 4 PM's,...and the user gets a reply on PM number 3, I want PM number 3 to be displayed first.

Thanks for any input.

-- Jason

Reply With Quote
  #2  
Old October 21st, 2002, 09:43 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 7
Create a new field in your DB. This field will hold a flag, you could set a flag in this field as '0' equals a read message and '1' equals a new message. You could use that on the PM display page. On your forum, or main page, you can query the DB for the logged user and count the flags. 5 ones (1) would equal 5 new messages. Also, when they view the message within thier PM display page, UPDATE the DB field to represent the new flag, in this case a '0'. Pretty simple to do and implement....

Last edited by jpenn : October 21st, 2002 at 09:45 PM.

Reply With Quote
  #3  
Old October 21st, 2002, 10:20 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
jpenn, thats a great way to do it!

Taelo, i would suggest using jpenn's way, but if your looking for something quick, try cookies

Reply With Quote
  #4  
Old October 21st, 2002, 11:13 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
ok I think I am following you. Thank you for the input.

Reply With Quote
  #5  
Old October 21st, 2002, 11:25 PM
Joe4JC Joe4JC is offline
The name's Joe. Yours?
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Lurking in the shadows...
Posts: 147 Joe4JC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
JPenn (Joe Penn) has mad skillz because he always helps out at Devshed!
__________________
Check out 4Life today!

Reply With Quote
  #6  
Old October 22nd, 2002, 02:29 AM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 7
Lol Joe4JC,
Hey, there are some really really good application developers in the devshed community, I have learned from them guys...

I am sure there are some really good ones here also, but man, the guys over there are pretty incredible...

Last edited by jpenn : October 22nd, 2002 at 02:31 AM.

Reply With Quote
  #7  
Old October 23rd, 2002, 12:10 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
ok well

well I didn't wanna post again until I had some time to think about this. Let me see if I am understanding correctly,...

Are you saything to create another table and it in store an Order Field PM ID Field and UserID Field?

If I did that, everytime that user got a PM,....I would have use a for loop or something to increment each Foriegn Key to the Order ID.

Is this what you are talking about?

Reply With Quote
  #8  
Old October 23rd, 2002, 07:21 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 7
Quote:
Are you saything to create another table and it in store an Order Field PM ID Field and UserID Field?

Well, no. An efficient DB layout would have a seperate table for PM's only. In this table you would have the PM_ID_NUMBER, the PM_SENDER, the PM_RECIEVER, the PM_SUBJECT, the PM_MESSAGE and the PM_FLAG -> the flag being the number number '0' or '1', as I discussed in the earlier reply. You do have a seperate table for your messenger, correct?

Quote:
If I did that, everytime that user got a PM,....I would have use a for loop or something to increment each Foriegn Key to the Order ID.

Ok.... When your user enters the page that displays you have such and such messages in your inbox, being your main site page or whatever page in your community or user area, your function would do a very simple query, like so ->
PHP Code:
 $query mysql_query"SELECT pm_flag FROM messenger_table WHERE pm_reciever = '$user_name_sess_var'" );
$x '0';
while ( 
$messages mysql_fetch_array$query ) )
    {
        if ( 
$messages['pm_flag'] )
            {
                
$x++
        }
}

/*

    $x now holds the number of new messages ( or 1's ) for the user

*/ 

Now, the code above is efficient. The code is efficient in a way that when using '0' and '1' as the flags, we do not have to use a comparison of any sort to determine the '0' or '1' to increment the count... --> A '0' will return false and a '1' will return true.

Last edited by jpenn : October 23rd, 2002 at 07:24 PM.

Reply With Quote
  #9  
Old October 23rd, 2002, 07:50 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
I follow you now

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > page has been viewed?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT