ohdang888 Posted March 9, 2008 Share Posted March 9, 2008 ok so i have a notification system that tells users if there is a friend request or message. But when there's nothing, it won't display "Nothing =(" i've marked where the problem most likely is, but i obivously don't know for sure if thats the problem. <?php $result = mysql_query("SELECT `1`,`2` FROM `friend_requests` WHERE `id`='{$id}'") or die(mysql_error()); $new_friends = mysql_fetch_array($result); $new_request1 = stripslashes($new_friends['1']); $new_request2 = stripslashes($new_friends['2']); if($new_request1 != 0){ if($new_request2 != 0){ Echo '<a href="friend_request.php">New Friend Requests</a>'; }else{ Echo '<a href="friend_request.php">New Friend Request</a>'; } }else{ $new_friends0 = 'none';// here? } $result = mysql_query("SELECT `id` FROM `messages` WHERE `to`='{$id}' and `read`='0'") or die(mysql_error()); $count = mysql_num_rows($result); while($row = mysql_fetch_assoc($result)){ if(strlen($row['id']) > 0){ echo '<br>You have '.$count.' new messages!'; }else{ $new_messages = 'none'; //here? } } if($new_friends0 == 'none'){ if($new_messages == 'none'){// around here echo 'Nothing =('; } } ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 9, 2008 Share Posted March 9, 2008 Try this: <?php $result = mysql_query("SELECT `1`,`2` FROM `friend_requests` WHERE `id`='{$id}'") or die(mysql_error()); $new_friends = mysql_fetch_array($result); $new_request1 = stripslashes($new_friends['1']); $new_request2 = stripslashes($new_friends['2']); if($new_request1 != 0){ if($new_request2 != 0){ Echo '<a href="friend_request.php">New Friend Requests</a>'; }else{ Echo '<a href="friend_request.php">New Friend Request</a>'; } }else{ $new_friends0 = 'none';// here? } $result2 = mysql_query("SELECT `id` FROM `messages` WHERE `to`='{$id}' and `read`='0'") or die(mysql_error()); $count = mysql_num_rows($result2); while($row = mysql_fetch_assoc($result2)){ if(strlen($row['id']) > 0){ echo '<br>You have '.$count.' new messages!'; }else{ $new_messages = 'none'; //here? } } if ((mysql_num_rows($result) < 1) && (mysql_num_rows($result2) < 1)){ echo 'Nothing =('; } ?> Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted March 9, 2008 Author Share Posted March 9, 2008 works. thanks! Quote Link to comment 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.