'Warning: expects resource but string given

I get:

"Resource id #8 Warning: mysql_fetch_array() expects parameter 1 to be resource, string given"

Heres the code:

$sql="SELECT password FROM user WHERE userid=$userid";    
echo $password=mysql_query($sql);
        
while($row = mysql_fetch_array($password)) {
    $password = $row['password'];
}   

Any ideas?

php


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source