Jump to content

Unread Inbox Message


RaythMistwalker

Recommended Posts

//check Messages
$qry2="SELECT * FROM messages WHERE to_id='$id'";
$result2=mysql_query($qry2) or trigger_error('Query error! Query: <pre>'.$qry2.'</pre>Reason: ' . mysql_error());
$num2=mysql_numrows($result2);

mysql_close();

//Check for Unread Messages
$unread=0;
$a=0;
while ($a < $num2) {
   $msg=mysql_result($result2,$a,"viewed");
   if ($msg < 1) { ++$unread; }
   ++$a;
}

This is my current working code to check if a user has unread messages and if they do then the inbox link is bold. Is there a way to make php send a pop up with just an ok button which closes the popup to alert the user they have unread messages?

Link to comment
Share on other sites

sorry i don't understand what you mean by this.

 

1. Page Loads

2. Div is created with a hidden display. Div contains only a message (You have unread messages) and a button (possibly an image that acts as a button)

3. Php checks database to see if there are unread messages

4. If php finds unread messages then use javascript to set the div's display to visible

5. If user clicks the button the image goes away

6. Understanding achieved ;)

Link to comment
Share on other sites

Just curious what kind of forum is this you are making?

Its not a forum its just the member section of a website but i coded a pm system for the members as well. If you want i can pm you the link and make you an account cos the accounts are admin controlled atm.

 

 

 

Also: that jQuery tutorial isn't helping much. I loaded the script into a test web-page and it still loaded the link. I'm using firefox if this affects it

Link to comment
Share on other sites

jQuery is cross browser, so it doesn't matter what browser you use,

did you include the jQuery correctly? Also, the download on the jQuery website

puts a .js.txt extension at the back of the file, rename it to jquery.js

jQuery normally has all the scripting you want to achieve, this speeds up

development quite a lot...

 

And always make sure you end the statements correctly, it won't throw

out errors even though there are... e.g.:

 

$(document).ready(function(){

  $("a").click(function(event){

    alert("As you can see, the link no longer took you to jquery.com");

    event.preventDefault();

  });

});

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.