0

This is probably like the most stupid question, but I can't figure it out, and I don't know why, but it's giving me an error saying that it was given a boolean. Here is my code.

if (mysql_num_rows(($result1) && $result) == 0) {
    echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>No such user: <b>$u_name</b></div>";
    exit();
}

EDIT:

I feel like the error is around in here somewhere, like is there a misplaced bracket or something like that:

if (mysql_num_rows(($result1) && $result) == 0)
1
  • 1
    Don't you think you need to provide us with just a little bit more? Commented Mar 17, 2014 at 3:40

1 Answer 1

1

Perhaps:

if (mysql_num_rows($result1) == 0 && $result)

mysql_num_rows() expects the result of mysql_query(), see https://www.php.net/mysql_num_rows. You were trying to provide it a boolean:

mysql_num_rows($result1 && $result) == 0)
               ^^^^^^^^^^^^^^^^^^^
Sign up to request clarification or add additional context in comments.

2 Comments

Does this check if $result1 is = 0 and then check if $result is = 0?
@Schnebz okay glad to hear it, keep in mind this is completely untested :)

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.