g3mma111 Posted August 11, 2007 Share Posted August 11, 2007 Hi. Im fairly new to PHP and cant work out how to do this code properly: if (mysql_num_rows($result) > 0 ) { or ('$username' = '$ses_username') echo '' } else { i want to make it so that if there are more than 0 results or the session username = the username then it doesnt say anything. I get the error that there should be no 'or' but im not sure how to do it without the or!? Quote Link to comment https://forums.phpfreaks.com/topic/64400-solved-help-please/ Share on other sites More sharing options...
Fadion Posted August 11, 2007 Share Posted August 11, 2007 if(mysql_num_rows($result) > 0 or $username == $ses_username) { With OR it will return true only if one or both statements are true. With AND boths statements must be true to return true. Use '==' (identical operators) when comparing, cos with '=' u are assignin values. Also im assuming u have a code like this for the session part: session_start(); $ses_username = $_SESSION['user']; Quote Link to comment https://forums.phpfreaks.com/topic/64400-solved-help-please/#findComment-321082 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.