Xtremer360 Posted July 2, 2011 Share Posted July 2, 2011 For some reason its showing the first td with the image and it shouldnt' be the first td has a userID value of 10000. <?php echo "<td>"; echo $row['userID']; if (($row['userID'] !== 10000) || ($row['userID'] !== $userID)) { echo "<a href=\"#\" class=\"ask\"><img src=\"images/trash.png\" class=\"delete\" alt=\"\" title=\"\" border=\"0\" id=\"".$row['userID']."\" /></a>"; } echo "</td>"; ?> Quote Link to comment Share on other sites More sharing options...
EdwinPaul Posted July 2, 2011 Share Posted July 2, 2011 Try changing !== to != (one equal-sign) Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 That won't work because != is for javascript and !== is php but its still not working. I even tried putting 10000 in single quotes and nothing. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 2, 2011 Share Posted July 2, 2011 That won't work because != is for javascript and !== is php but its still not working. I even tried putting 10000 in single quotes and nothing. http://www.php.net/manual/en/language.operators.comparison.php Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 Ah my mistake but I still don't have an answer. Quote Link to comment Share on other sites More sharing options...
EdwinPaul Posted July 2, 2011 Share Posted July 2, 2011 Why do you give your img: id=\"".$row['userID']."\" When you look at the source of the displayed page, what do you see? Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 2, 2011 Share Posted July 2, 2011 <?php echo "<td>"; echo $row['userID']; if ($row['userID'] != 10000 || $row['userID'] != $userID) { echo "showing"; } echo "</td>"; ?> Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 2, 2011 Share Posted July 2, 2011 Wait, maybe this should be an AND for logic? Want to make sure it's their user id, but not 10000 <?php echo "<td>"; echo $row['userID']; if ($row['userID'] != 10000 && $row['userID'] == $userID) { echo "<a href=\"#\" class=\"ask\"><img src=\"images/trash.png\" class=\"delete\" alt=\"\" title=\"\" border=\"0\" id=\"".$row['userID']."\" /></a>"; } echo "</td>"; ?> Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 I can understand why you would think that but the purpose of that if is for it to see if its the 10000 aka non deletable user or that the $row['userID'] is the same as the current logged in user meaning they can't delete themselves if they are logged in. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 2, 2011 Share Posted July 2, 2011 <?php echo "<td>"; echo $row['userID']; if ($row['userID'] != 10000 && $row['userID'] != $userID) { echo "<a href=\"#\" class=\"ask\"><img src=\"images/trash.png\" class=\"delete\" alt=\"\" title=\"\" border=\"0\" id=\"".$row['userID']."\" /></a>"; } echo "</td>"; ?> Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 Can you explain why its && because it should see if the row has the userID of 10000 then if it doesn't then it checks to see if the row is equal to teh session $userID. If either are true then it doesn't display that image. Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted July 2, 2011 Share Posted July 2, 2011 if user not 10000 OR user not equal to user echo result in either condition if user not 10000 AND user not equal to user echo result if both conditions are met so if you do OR and user is user it would always show image even if userid is 10000 Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 If that's the case then why do you have && instead of OR Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 2, 2011 Share Posted July 2, 2011 Read the full statement to yourself and it should make sense. if($row['userID'] != 10000 && $row['userID'] != $userID) IF $row doesn't equal 10000 AND $row doesn't equal $userID The other way: ($row['userID'] != 10000 || $row['userID'] != $userID) IF $row doesn't equal 10000 OR $row doesn't equal $userID It does NOT read If $row doesn't equal 10000 OR $userID Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted July 2, 2011 Author Share Posted July 2, 2011 Oh thank you Pikachu2000 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.