PHP:在while语句上更新变量

I am new to the PHP world! Currently practicing MySQL and PHP alone

I want to update my <p> content when my query is completed. But seems like my $name only shows the previous value:

$query = $_GET['query'];
$stmt = $conn->prepare("SELECT * FROM wordList WHERE word = '$query'");
$name = ''; // my variable
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_assoc()) {
    $name == $row['word']; // not working
}

And I am not getting the actual data I want in my HTML:

<p>My name is: <?php echo $name; ?></p>

But getting:

My name is:

Thanks

Try using only one equal to symbol = instead of ==.

$name = $row['word'];