致命错误:在布尔值FOR PHP上调用成员函数fetch_array()[复制]

I couldn't found the answer as this question had been asked so many times..yet i still need your help about this...i am new to php...

    <?php

    require_once 'dbconnect.php';
    session_start();
    $_SESSION['user'] = 1;
    // if session is not set this will redirect to login page
    if( !isset($_SESSION['user']) ) {
        header("Location: index.php");
        exit;
    }
    // select loggedin users detail
    $sql = "SELECT * FROM user WHERE userId=".$_SESSION['user'];
    $result = $conn->query($sql);
     while($row = $result->fetch_array()) {
        $userRow[] = $row;
 }


    mysqli_close($conn);
?>

problem found at this line:

while($row = $result->fetch_array()) {

i tried the method that the questions asked in here..still return the same error for me...

EDIT 2: even i set the session start() it still bring the same fatal error to me... by adding the session start() it bring another error to me

Notice: A session had already been started - ignoring session_start()
</div>