New Messaging [Resolved]

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

New Messaging [Resolved]

Post by Epiales »

Hey all,

I'm working on making the messages flash a gif image when there are new messages. Right now I have 2 different colored png's, but it's not working with them, so won't with the gif. What is me doin' wrong? lol

Code: Select all

<?php
$i = 0;    
$messageinfo="SELECT pid FROM messages where pid='$user[username]' AND readm = '1'";
$messageinfo2=mysql_query($messageinfo) or die("Could not get messages");
    while($messageinfo3=mysql_fetch_array($messageinfo2)) {
    $i = $i + 1;
}

    if($i > 0) {echo "<img src = 'images/mail.png' width='30'><a href='messages.php?messages=1'></a></font></a>";    
}
    else{echo "<img src = 'images/mail2.png' width='30'><a href='messages.php?messages=1'></a></font></a>";
}
?>
Last edited by Epiales on Sun Sep 29, 2013 11:18 am, edited 1 time in total.
Nothing fancy, but a work in progress!

http://gameplaytoday.net
Winawer
Posts: 180
Joined: Wed Aug 17, 2011 5:53 am

Re: New Messaging

Post by Winawer »

What's the actual problem? Like, how is it not working?

Your HTML looks a bit weird, there's some extra closing tags in there, also the link has no content in it.
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: New Messaging

Post by Epiales »

Winawer wrote:What's the actual problem? Like, how is it not working?

Your HTML looks a bit weird, there's some extra closing tags in there, also the link has no content in it.
It only shows the first image, regardless of whether you have new or no new mail...

I redid the changes, as I removed fonts and such to put images:

Code: Select all

<?php
$i = 0;    
$messageinfo="SELECT pid FROM messages where pid='$user[username]' AND readm = '1'";
$messageinfo2=mysql_query($messageinfo) or die("Could not get messages");
    while($messageinfo3=mysql_fetch_array($messageinfo2)) {
    $i = $i + 1;
}

    if($i > 0) {echo "<a href='messages.php?messages=1'><img src = 'images/mail.png' width='30'></a>";    
}
    else{echo "<a href='messages.php?messages=1'><img src = 'images/mail2.png' width='30'></a>";
}
?>
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: New Messaging

Post by Epiales »

LOL too funny. The changes I made up top work. Problem sovled. Geesh :) Thank you!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: New Messaging

Post by vitinho444 »

I know it's solved but why don't you use a gif instead of 2 png?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: New Messaging

Post by Epiales »

vitinho444 wrote:I know it's solved but why don't you use a gif instead of 2 png?
OH...I am, I just made two colored pings to work with. Now that it's working, I have already created the gif animation :lol:

Thanks!
Nothing fancy, but a work in progress!

http://gameplaytoday.net
Post Reply

Return to “Beginner Help and Support”