Page 1 of 1

New Messaging [Resolved]

Posted: Sun Sep 29, 2013 9:56 am
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>";
}
?>

Re: New Messaging

Posted: Sun Sep 29, 2013 10:11 am
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.

Re: New Messaging

Posted: Sun Sep 29, 2013 10:37 am
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>";
}
?>

Re: New Messaging

Posted: Sun Sep 29, 2013 10:52 am
by Epiales
LOL too funny. The changes I made up top work. Problem sovled. Geesh :) Thank you!

Re: New Messaging

Posted: Sun Sep 29, 2013 11:03 am
by vitinho444
I know it's solved but why don't you use a gif instead of 2 png?

Re: New Messaging

Posted: Sun Sep 29, 2013 11:10 am
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!