ted_chou12 Posted January 5, 2007 Share Posted January 5, 2007 I have a private message system, however, I wish to know how to use flag so that I can inform my users that they have new messages when there are unread messages as well as coloring their inbox, so that unread message will look more obvious.ThanksTed Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/ Share on other sites More sharing options...
HoTDaWg Posted January 5, 2007 Share Posted January 5, 2007 well i would assume once u click one of the rows which output all messages in the inbox then the word "read" is added to a database. that way, simple if/else statements can help determine if there is a new/unread message in the inbox.[code]<?phpif($row['read']="read"){//if the the word read is found in the column read (meaning the user has read this message, then the font color //is blackecho'<font color="#000000"><a href="inbox.php?messageid=$id">$messagename</a>';}else{ //however, if read is not found in the read column then the font is redecho'<font color="#FF0000"><a href="inbox.php?messageid=$id">$messagename</a>';//this is probably what the code would look like?>[/code]HoTDaWg Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153269 Share on other sites More sharing options...
ted_chou12 Posted January 5, 2007 Author Share Posted January 5, 2007 So what flag is, is basically a new column, there are two values possible, Read/Unread.if ($row['flag'] == "Read") {echo "<img src=\"readflag.gif\">";}else {echo "<img src=\"unreadflag\">";}so this is it? :-\ Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153306 Share on other sites More sharing options...
HoTDaWg Posted January 5, 2007 Share Posted January 5, 2007 well, what you can do is create a new column called read and everytime a user reads a message insert the term, "read" into the database under that column. Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153327 Share on other sites More sharing options...
ted_chou12 Posted January 5, 2007 Author Share Posted January 5, 2007 By the way, should I have a new table for each new user or just a table for private messages and a column indicating that the message belongs to which user, which one is better?TedThanks for the suggestion Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153330 Share on other sites More sharing options...
HoTDaWg Posted January 5, 2007 Share Posted January 5, 2007 hmmm...well too be honest i have never made a script of that caliber. Perhaps somone else can answer that for you?*hint to other members:Psorry,HoTDaWg Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153371 Share on other sites More sharing options...
chronister Posted January 5, 2007 Share Posted January 5, 2007 IF you end up with 500 members, do you really want to mess with 500 tables??If that is not a problem, then go ahead, but the more efficient way of doing it would be to have 1 table for the pm's and then link each pm to the user(s) with an id. Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153373 Share on other sites More sharing options...
HoTDaWg Posted January 5, 2007 Share Posted January 5, 2007 [quote author=chronister link=topic=121069.msg497305#msg497305 date=1167978843]IF you end up with 500 members, do you really want to mess with 500 tables??If that is not a problem, then go ahead, but the more efficient way of doing it would be to have 1 table for the pm's and then link each pm to the user(s) with an id.[/quote]thank you for completely saying what i could not say :) Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153376 Share on other sites More sharing options...
ted_chou12 Posted January 5, 2007 Author Share Posted January 5, 2007 thanks for saving my life as well.. :P Link to comment https://forums.phpfreaks.com/topic/32922-solved-how-does-flag-work/#findComment-153387 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.