如果声明里面的while循环在MYsql Fetch Array中[关闭]

Hi I am trying to make a simple look and depending the the current loged user inside the website to show different results. Here is my code which it seems not to be working correctly:

    while( $row = $stmt->fetch()){
    if(($_SESSION['username']) == "user1" || "user2"){
    echo "content";}
    esle {echo "conent2";}

So basically if user1 or user2 is logged in do the first echo if some other user is logged in do the second echo.

Any suggestions how this can be made to work ?

There are a few issues with your test. Try replacing it with this inside your loop:

if(in_array($_SESSION['username'],array("user1","user2"))){
    echo "content";
} else {
    echo "conent2";
}