Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Bit of PHP help (Views)
Old 06-09-2005, 07:08 AM Bit of PHP help (Views)
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
How can I make it so that, if you have a message in your inbox, which is new, then you click it (to read it obviously) and then it'll say you have no new messages (but the message will stay there, because you have only read it)..
Anyone get what I mean?
Help please
feraira is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-09-2005, 07:12 AM
Kyrnt's Avatar
The Post-Mod Years

Posts: 2,536
Location: Western Maryland
Trades: 0
feraira,

I am not sure how this is a PHP issue. Once your send a message (and I presume you are referring to email), the behavior of that message in the INBOX becomes a function of the email client (e.g., Outlook, Thunderbird).
__________________
—Kyrnt
Kyrnt is offline
Reply With Quote
View Public Profile Visit Kyrnt's homepage!
 
Old 06-09-2005, 08:04 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Nooooooooooo, you don't get me lol, like if you look at these forums, they have "7 views" or something right? I have created a messenger for my site (www.xing-designs.com) and I am trying to make it so that it only tells you that you have NEW messages (ones which haven't been read), whereas if they are old, they stay in the inbox, but not say "1 new message" if you get me?
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 08:09 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Then in your SQL you flag it.. say u have a field that says "message_status", and simply a tinyint(1) - so a new message would be 0, old would be 1, archived would be 2 so on and so on.

Use PHP to look that up and then determine what it should do after that, simple!
__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 08:23 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Yeah I understand that I will have to create a new field in the table for it like you said, and yes a new message would be 0 and old would be 1, or vice versa.. but how would I tell the database to change that when they click it?
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 11:10 AM
leavethisplace's Avatar
Ultra Talker

Posts: 297
Trades: 0
Use something like below, the OpenDataBase() function won't work, it my own function, but look at the second argument of the function to see the correct SQL statement. The $SetStatus is there because the StatusMail() function usually does more than simply set it to read in my scripts, and the $IDRef is the ID of the message that needs to be marked as read.
PHP Code:
function StatusMail ($SetStatus$IDRef) {

   if (
$SetStatus == 'Read') {
    
        
$result OpenDataBase("fester_db""UPDATE EmailData SET Status = '0' WHERE IDRef = '$IDRef'");

        
$result mysql_query($result);

    } 

__________________
A lie gets halfway around the world before the truth has a chance to get its pants on. - Sir Winston Churchill

Please visit my sites:
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
leavethisplace is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 06:17 PM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
OK, for a guy kinda newish to parts of PHP like this, how can it be done? Easily ...
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-09-2005, 07:49 PM
Monkeon's Avatar
Skilled Talker

Posts: 59
Trades: 0
The page that displays the opened message will need to update the database record you talked about earlier. Lets say that field is called 'Viewed'

you would want something like this on your message page.

PHP Code:
mysql_connect(localhost,$username,$password);

$query="UPDATE inbox SET viewed='1' WHERE message_id='$id'";
mysql_query($query);
mysql_close(); 
Then your code that displays how many new messages there are would be something like this...

PHP Code:
// Check for NEW unread messages
$query mysql_query("SELECT * FROM inbox WHERE user='$user' AND viewed='0'");
$newmessages mysql_num_rows($query);
mysql_close();
echo 
"You have $newmessages in your inbox"
you see? MySQL selects all the viewed=0 rows and counts how many rows there are. Thus telling you how many unread messages are in the inbox!
Monkeon is offline
Reply With Quote
View Public Profile
 
Old 06-10-2005, 06:51 AM
feraira's Avatar
BeTheBand!

Posts: 350
Trades: 0
Ok thanks for the help guys, I didn't think it would be that easy lol! Thanks again guys!

See it in action: www.xing-designs.com
feraira is offline
Reply With Quote
View Public Profile
 
Old 06-10-2005, 07:06 AM
Monkeon's Avatar
Skilled Talker

Posts: 59
Trades: 0
Heh heh, no problem.

Awesome web site by the way.
Monkeon is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Bit of PHP help (Views)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.31146 seconds with 12 queries