Jump to content
MakeWebGames

Recommended Posts

Posted

For hospital, jail, mail and events is it possibleto have a counter that updates without you refreshing the page, and as seen in facebook could you make a javascript function to change the title of the page from "game name" to "1 New Message".

Would appreciate it if someone could either point me in the right direction or post up something they have already made. Thanks

Posted

Above the <head> </head> bit in your header.php file, i'm sure you could run a query something along the lines of...

$x = $db->query("SELECT `newmail` from `mail` WHERE `newmail` > 0 ");

Just an example i can't remember what the mail tables are at the moment ^

$y = $db->fetch_row($x);

$mail = ($y['newmail'] > 0) ? $y['newmail'] : '' ;

Something along those lines, then in your <head> tags just insert the php code

<head>' . $mail . '</head>

or if your head is html / xhtml

<head><?php echo ' . $mail . ' ; ?> </head>

Posted

Thanks for the code above joshua but i am curious as to why you did this:

 

$y = $db->fetch_row($x);

 

Could you not have just used $x instead of having to use $y to call $x ?

By the way im not questioning your work, im not a great coder lol i just want to know why this was done.

Posted

If you want to make a real responsive page, you would need to involve some kind of Ajax implementation.

If you are familiar with Ajax, it should be quite easy. If not - well, just leave it as it is now because it will be much simpler.

TIP: If you are using MCC v2, look at the ajax handler script(don't know what it's called) that the register page uses. Also look into the register script itself to find out how it works.

Ultimately you would have to use a timer as well, to refresh the time value at every X interval.

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.   Paste as plain text instead

  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...