Alright, this is sort of hard to explain, and I bet it's a simple fix, but here is my problem.
In my user system, where visitors can login, I have a private message feature. When you receive a message, it shows how many unread messages you have on the side (where the navigation for the user system is). My problem is that when you go to read the message, it sets the status (being read - 0 - or unread - 1). My problem is that when I go to read the message, and it sets the status to 1 (being read) it still shows that I have one unread message on the navigation for the user system. When I refresh the page, it then shows it as unread on the side. Here is my code for changing the status (pmc.php):
And to show the unread:
How can I make it set the status to 1 before it reads the message, so when I am reading the message it won't show the message being read as unread on the side of my navigation?
I was thinking of doing a onclick on the href when I go to read the message, but I am not sure how I would do that without using Javascript.
Thanks and Kind Regards!
In my user system, where visitors can login, I have a private message feature. When you receive a message, it shows how many unread messages you have on the side (where the navigation for the user system is). My problem is that when you go to read the message, it sets the status (being read - 0 - or unread - 1). My problem is that when I go to read the message, and it sets the status to 1 (being read) it still shows that I have one unread message on the navigation for the user system. When I refresh the page, it then shows it as unread on the side. Here is my code for changing the status (pmc.php):
| Code: |
|
$id = $_GET['id']; $update = mysql_query("UPDATE `privatem` SET `status` = '1' WHERE `id` = '$id'"); |
And to show the unread:
| Code: |
|
$privatemessages = mysql_query("SELECT * FROM `privatem` WHERE `to` = '$username' AND `status` = '0'"); $pm = mysql_num_rows($privatemessages); echo "Inbox ($pm)"; |
How can I make it set the status to 1 before it reads the message, so when I am reading the message it won't show the message being read as unread on the side of my navigation?
I was thinking of doing a onclick on the href when I go to read the message, but I am not sure how I would do that without using Javascript.
Thanks and Kind Regards!
