简体   繁体   中英

if (mysql_num_rows(($result1) && $result) == 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)

Perhaps:

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM