Styles2304 Posted May 14, 2008 Share Posted May 14, 2008 Strange problem . . . I have 7 entries in the database. The way it's supposed to work is that the person viewing their own profile doesn't see themselves (the IndexNo != '" . $_SESSION['user_index'] . "' takes care of that) but sees everyone else which would be 6 other users. However, it's always showing 1 less than what it should so, in this case, it's only showing 5. If I have 5 accounts, it only shows 3 but it should show 4. Make sense? I'm not really sure what could even be causing this but I posted the code so hopefully I can get some help. Fair amount of code so I apologize for that but here it is: <?php //Friend Variables $Friends = ' '; $FriendCounter = 0; if (($_GET['ViewFriends'] == '') || ($_GET['ViewFriends'] == 'all')) { $query = "SELECT * FROM Profile WHERE Permissions = 'Y' AND IndexNo != '" . $_SESSION['user_index'] . "' ORDER BY FirstName;"; } if ($_GET['ViewFriends'] == 'online' ) { $query = "SELECT * FROM Profile WHERE Permissions = 'Y' AND ($CTime - OnlineStatus < 300) AND (IndexNo != '" . $_SESSION['user_index'] . "');"; } if ($_GET['ViewFriends'] == 'new' ) { $query = "SELECT * FROM Profile WHERE Permissions = 'Y' AND (New = 'Y') AND (IndexNo != '" . $_SESSION['user_index'] . "');"; } $result = mysql_query($query, $link) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { $FriendIndex = $row['IndexNo']; $FriendFirstName = $row['FirstName']; $FriendLastName = $row['LastName']; $FriendPicture = $row['Picture']; $FriendOnlineStatus = $row['OnlineStatus']; $FriendCurrentStatus = $row['CurrentStatus']; $FriendName = $FriendFirstName . ' ' . substr($FriendLastName, 0, 1); $FriendPictureData = explode(".", $FriendPicture); $FriendPictureName = $FriendPictureData[0] . 'sml'; $FriendPicture = $FriendPictureName . '.' . $FriendPictureData[1]; if ($FriendCounter == 3) { $Friends .=<<<EOD </tr> <tr> EOD; $FriendCounter = 0; } else { $Friends .=<<<EOD <td width="90"> <table width="100%" border="0"> <tr> <td valign="top" align="center"> <font class="blogh2"> <a href="profile.php?IndexNo=$FriendIndex">$FriendName</a> </font> </td> </tr> <tr> <td valign="top" align="center"> <b><a href="profile.php?IndexNo=$FriendIndex"><img src="images/users/$FriendPicture" width="64" height="81" border="0" title="$FriendCurrentStatus" alt="$FriendCurrentStatus"><a></b> </td> </tr> <tr> <td valign="top" align="center"> EOD; if ($CTime - $FriendOnlineStatus >= 300) { $Friends .=<<<EOD <a href="profile.php?IndexNo=$FriendIndex"><img src="images/offline.png" border="0"></a> EOD; } else { $Friends .=<<<EOD <a href="profile.php?IndexNo=$FriendIndex"><img src="images/online.png" border="0"></a> EOD; } $Friends .=<<<EOD </td> </tr> </table> </td> EOD; $FriendCounter = $FriendCounter + 1; } } ?> Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/ Share on other sites More sharing options...
Styles2304 Posted May 14, 2008 Author Share Posted May 14, 2008 Anyone have any vague ideas? Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-541342 Share on other sites More sharing options...
Styles2304 Posted May 15, 2008 Author Share Posted May 15, 2008 Bump . . . ? This is a message board system for my Church Youth Group . . . I'm kind of desperate. Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-541476 Share on other sites More sharing options...
Styles2304 Posted May 15, 2008 Author Share Posted May 15, 2008 Can you guys at least tell me if you DON'T see a problem? I want to make sure I'm not the only crazy one. Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-541489 Share on other sites More sharing options...
Styles2304 Posted May 15, 2008 Author Share Posted May 15, 2008 I'm desperate folks! lol Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-541669 Share on other sites More sharing options...
Styles2304 Posted May 15, 2008 Author Share Posted May 15, 2008 I'll throw this back up top. Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-542075 Share on other sites More sharing options...
Styles2304 Posted May 15, 2008 Author Share Posted May 15, 2008 if ($FriendCounter == 3) { $Friends .=<<<EOD </tr> <tr> EOD; $FriendCounter = 0; } else { ^^ Was causing it to skip a profile every time FriendCounter got to 3 due to the "else". Solved! Link to comment https://forums.phpfreaks.com/topic/105655-solved-strange-problem-missing-database-info/#findComment-542168 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.