PHP代码没有做我想要的

I currently have this code. its supposed to get a name from my MySQL database in the row "name" then put "name" into the line of code here:

    echo "<img src="http://cravatar.eu/avatar/"name"/50.png">"

but its not working can someone point out whats going wrong it is just keeping $row ['name'] where I want the name to be. I want it so it gets the name from the database and puts the name in the avatar/name/50.png.

Also, I have multiple names in my database; how do I add a picture for all of them? I want it to be a 2-row, 30-column table using the 60 most recent entries to the recentplayers table in my database.

Here is my name.php if that helps:

    <?php
    $con = mysql_connect("host","user","password");
    if (!$con)
    {
      die('Could not connect: ' . mysql_error());
    }

    mysql_select_db("quollcr1_hub", $con);

    $result = mysql_query("SELECT * FROM recentplayers");
    echo "<img src="http://cravatar.eu/avatar/$row ['name']/50.png">"

    while($row = mysql_fetch_array($result))
    {
      echo "<tr>";
      echo "<td>" . $row['name'] . "</td>";
      echo "</tr>";
    }
    echo "</table>";

    mysql_close($con);
    ?>

You need to fetch the $row before using it, try this:

$con = mysql_connect("host", "user", "password");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("quollcr1_hub", $con);

$result = mysql_query("SELECT * FROM recentplayers");
$row = mysql_fetch_array($result);
if ($row) {
    echo '<img src="http://cravatar.eu/avatar/' . $row ['name'] . '/50.png">';
    echo "<table>";
    echo "<tr>";
    echo "<td>" . $row['name'] . "</td>";
    echo "</tr>";

    while ($row = mysql_fetch_array($result)) {
        echo "<tr>";
        echo "<td>" . $row['name'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
}

mysql_close($con);

*Update

To show image for every row you can do something like this:

<?php
$con = mysql_connect("host", "user", "password");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}

mysql_select_db("quollcr1_hub", $con);

$result = mysql_query("SELECT * FROM recentplayers");
echo "<table>";
while ($row = mysql_fetch_array($result)) {
    echo "<tr>";
    echo "<td>" . '<img src="http://cravatar.eu/avatar/' . $row ['name'] . '/50.png">' . "</td>";
    echo "<td>" . $row['name'] . "</td>";
    echo "</tr>";
}
echo "</table>";
mysql_close($con);

change this line

"<img src="http://cravatar.eu/avatar/$row ['name']/50.png">"

to this line and try

"<img src='http://cravatar.eu/avatar/" . $row ['name'] . "/50.png'>"

another thing..

you haven't declared $row before using $row, you might want to add it below while loop.

Actually main problem is that you are using $row['name'] instead of img tag while you getting data after using img tag. You need to get the data in $row befor img tag.

<?php

$result = mysql_query("SELECT * FROM recentplayers");
while($row = mysql_fetch_array($result))
{
 echo "<img src="http://cravatar.eu/avatar/$row ['name']/50.png">"
 echo "<tr>";
 echo "<td>" . $row['name'] . "</td>";
 echo "</tr>";
}

?>