连接说明

I need a clear explanation.

Take a look at the code

<?php
$user_id = $_GET['user_id'];                  
include "../database.php"; 
$query="SELECT name FROM user WHERE user_id='$user_id'";
$result=mysqli_query ($connect, $query);

while($data = mysqli_fetch_array ($result))
{
    $name=$data['name'];
    echo"<tr><td>$name</td></tr>";
}                   

?>

When i change into this one, the code still working. .

echo"<tr><td>".$data['name']."</td></tr>";

But, when i change into this one, it is not working. .

echo"<tr><td>$data['name']</td></tr>";

Do the way I use " and . matter?

You can also write it as

 echo "<tr><td>{$data['name']}</td></tr>";

or

echo "<tr><td>$data[name]</td></tr>";

or (fun fact not too many people know about):

echo '<tr><td>', $data['name'], '</td></tr>';

That's just PHP syntax for you. Read about strings on the official site.

. is for concatenation. Double quotes support "interpolation" but you have to use it correctly. If you want to access an array index, either put {} around the variable, or drop the ' (only works one-level deep I believe).

That last syntax is special for echo. echo isn't a function, so they're not really "arguments" but it will let you output multiple things by separating them with commas nonetheless.