0
if ( $bid != $USER OR mysql_num_rows($already) > 0) {
    echo "ok";
}

I have this line. I want "ok" to show, if $bid isn't the same as $USER OR if there doesn't exists any rows in the $already query.

What have I done wrong?

function show_block_Form($bid, $id, $USER){
$already = mysql_query("SELECT * FROM users_blocked WHERE bID = '$bid' AND uID = '$USER'") or die(mysql_error());
if($bid != $USER || mysql_num_rows($already)==0){
echo "ok"
}
}
3
  • Well, what happens when your run it? Commented Nov 13, 2010 at 19:00
  • Please explain what does those lines mean in your script or we will not be able to understand if it right or wrong! Commented Nov 13, 2010 at 19:12
  • He's given enough information for us to help him with this. There's not more that he can explain, without going into all the details of his specific project. Commented Nov 13, 2010 at 19:14

2 Answers 2

1

I want ok to show, if $bid isnt the smae as $USER *and* if there doesnt exists any rows in the $already query.

if($bid != $USER && mysql_num_rows($already) <= 0){
Sign up to request clarification or add additional context in comments.

1 Comment

You can then change it to or :)
1
if($bid != $USER OR mysql_num_rows($already)>0){

should be

if($bid != $USER || mysql_num_rows($already)==0){

14 Comments

I meant OR.. I tried to do OR mysql_num_rows($already)==0 it still shows OK
I fixed it; that's what I thought you meant but I wasn't sure.
okay, just tried that, it still shows. I tried to echo num_rows $already, and it outputs 1 so there is one row but still shows even with this restriction?!
My bet is that this is wrong: $bid != $USER. Try echoing $bid and $USER
Ok update i just checked the if arguments. If i remove $bid != $USER, the num_rows works, if i remove num_rows the $bid != $USER works.. It cant handle two arguments at same time?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.