TheMafia! Posted March 27, 2009 Posted March 27, 2009 I need abit of help with anouncements on mainmenu • <a href='ann.php' title='See the announcements.'>"; @$d=mysql_query("SELECT * FROM annoucements WHERE id={$ir['id']} AND id=0",$c); if (@mysql_num_rows($d) > 0) { print "<font color=red>[b]Anouncements (".mysql_num_rows($d).")</font>[/b]"; } else { print "Anouncements(0)"; } print "</a> i want it so when i post an announcement it turns red i think its the query... any help appreciated Quote
AlabamaHit Posted March 27, 2009 Posted March 27, 2009 Re: [v1]Need abit of help with anouncements wtf are the @ for? take those out....... and thats if your code is right..... Quote
Magictallguy Posted March 29, 2009 Posted March 29, 2009 Re: [v1]Need abit of help with anouncements wtf are the @ for? take those out....... and thats if your code is right..... If I'm right, the @ operator is to echo errors if the code is unable to do it's job properly (could be wrong).. <?php /* For this method, you would have to make an edit to the Admin Panel and the announcement.php. */ // Admin Panel edit // Add under the query that inserts the announcement into the database. mysql_query("UPDATE users SET new_announcements = new_announcements + 1") or die(mysql_error()); // Add in the announcement.php, underneath "print $content;" $sql = sprintf("UPDATE users SET new_announcements = 0 WHERE (userid = %u)", $userid); mysql_query($sql) or die(mysql_error()); // Then, the mainmenu edit is the same as the v2 version (posted below) ?> <?php // To be honest, I don't know.. I don't have a v1 source. That's on my 8gb pendrive. // If anyone finds my pendrive, I'll give you ?10! xD ?> <?php echo sprintf("[url='ann.php']%s (%u)[/url]", $ir['new_announcements'] ? "<span style='color:red;'>Announcements</span>" : "Announcements", $ir['new_announcements']); ?> Quote
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.