supermerc Posted March 11, 2007 Share Posted March 11, 2007 Hey, i followed obsidian tutorial for a om system, with special help (thanks again obisidian) And now I want a little envelope icon to show when I have a new message, so I tried something but its not working. <?php session_start(); require("config.php"); require("functions.php"); echo '<p>Welcome, '.$_SESSION['s_name'].',</p>'; echo '<p>You are logged in as '.$_SESSION['s_username'].'.'; echo '<p><a href="members.php">Members</a>'; echo '<p><a href="inbox.php">Inbox</a>'; $message = mysql_query("SELECT COUNT(*) FROM myPMs WHERE opened != 'y' AND to_id = '{$_SESSION['s_id']}'") or die ("My SQL Error: <br />". mysql_error()); $msgs = mysql_fetch_array($message); if ($msg['COUNT(*)'] > 0) { // News Msgs Found echo "<img src=\"images/envelope.gif\" /> You have {$msg['COUNT(*)']} new messages.<br />"; } ; echo '<br><a href="edit_profile.php">My Profile</a>'; echo '<br><a href="logout.php">Logout</a></br>'; ?> Please help thank you Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/ Share on other sites More sharing options...
AndyB Posted March 11, 2007 Share Posted March 11, 2007 Do you see a 'missing image' icon? View the generated html source. Is the image on your server in the folder you think it's in? Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204591 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 Yes i checked path and it works Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204593 Share on other sites More sharing options...
AndyB Posted March 11, 2007 Share Posted March 11, 2007 And what shows in the generated HTML code? Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204606 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 whats that? Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204609 Share on other sites More sharing options...
interpim Posted March 11, 2007 Share Posted March 11, 2007 whatever the script output page is... right click, view source... that is your html output Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204610 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 <p>Welcome, Alex Deslauriers,</p><p>You are logged in as supermerc.<p><a href="members.php">Members</a><p><a href="inbox.php">Inbox</a><br><a href="edit_profile.php">My Profile</a><br><a href="logout.php">Logout</a></br> Thats what I get Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204627 Share on other sites More sharing options...
jeremywesselman Posted March 11, 2007 Share Posted March 11, 2007 Have you checked to make sure that your query is returning a result? <?php print_r($msgs); ?> (might be a dumb question, but let's just be sure here) Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204652 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 I put it at the end of my code and this is what i got Array ( [0] => 2 [COUNT(*)] => 2 ) Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204654 Share on other sites More sharing options...
jeremywesselman Posted March 11, 2007 Share Posted March 11, 2007 lol. I can't believe I didn't see it before... if ($msg['COUNT(*)'] > 0) { You've got a spelling error. $msg should be $msgs... Jeremy Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204657 Share on other sites More sharing options...
supermerc Posted March 11, 2007 Author Share Posted March 11, 2007 Ok im officially in love with you Quote Link to comment https://forums.phpfreaks.com/topic/42172-solved-new-mail-icon/#findComment-204658 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.