PHP Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, array given on line 18
<p>I keep getting the following error below.</p>

<pre><code>Warning: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, array given on line 18
</code></pre>

<p>Line 18 is <code>while($password_query = mysqli_fetch_assoc($password_query)){</code></p>

<p>I was wondering how can I fix this problem?</p>

<p>Here is the full PHP code.</p>

<pre><code>function pc($login_data, $login_password){
    $password_query = "SELECT `users`.`salt` 
                       FROM `users` 
                       INNER JOIN `contact_info` 
                       ON `contact_info`.`user_id` = `users`.`user_id` 
                       WHERE (`contact_info`.`email` = '" . $login_data . "' 
                       OR `users`.`username` = '" . $login_data . "')";
    $password_count = ($password_query = mysqli_query(database(), $password_query)) ? mysqli_num_rows($password_query) : 0; 

    if($password_count === 0){
        return false;
    } else {
        while($password_query = mysqli_fetch_assoc($password_query)){
            $salt = $password_query['salt'];
        }

        if(!empty($salt)){
            return $sha512 = hash('sha512', $login_password . $salt);
        } else {
            return false;
        }       
    }
}
</code></pre>
