PHP虽然不会返回第一行

got a problem with my while statement, it will not display the first row & I have no idea why, any help would be appreciated.

 <?php
      $user = $_SESSION['username'];
      $result = mysql_query("SELECT *FROM bookwrite WHERE username = '$user' ", $connection);


    if (mysql_fetch_array($result)==0){
        $class = "hideMe";
        $firstnameResult = mysql_query("SELECT * FROM users WHERE username = '$user' ", $connection);

        $row2 = mysql_fetch_array($firstnameResult);
        echo "<div class=\"platOptions welcome\"><div class=\"welcomeinfo\"><h1>Welcome!</h1>Welcome to Little Quill, ".$row2["firstName"].". We see you are new to the platform. To get started by adding your first post please click the \"New Entry\" button below <a class=\"newentryBTN\" href=\"newEntry.php\">New Entry</a></div></div>";

    } else {
        $class = "";
        while ($row = mysql_fetch_array($result)) {
            echo nl2br("<li class=\"editable\" id=\"".$row["id"]."\">"."<div class=\"entryInfo clearfix\">"."<div class=\"statusWrapper\"><div class=\"status\"></div><div class=\"statusIcon\"></div></div>"."<h1>".$row["post_title"]."</h1>"."<div class=\"timeline-date entryDate\">".$row["post_date"]."</div>"."</div>"."<p contentEditable=\"true\">".$row["post_details"])."</p><a class=\"deleteBTN\"href='delete.php?id=".$row["id"]."'>x</a></li>";
         }


    }


 ?>

The first result is consumed by mysql_fetch_array, so when you start your loop you are consuming the second item. Try this code out, I basically assign the next value, at the end of the loop.

Also, I 100% agree with Jason McCreary, and I will make the comment that your current query is subject to SQL Injection. However, this should solve your first problem, helping you take a baby step towards to solution that's ultimately correct.

<?php
$user = $_SESSION['username'];
$result = mysql_query("SELECT * FROM bookwrite WHERE username = '$user' ", $connection);

$bookwrite_row = mysql_fetch_array($result);

if($bookwrite_row) {
    while($bookwrite_row) {
        echo nl2br("<li class=\"editable\" id=\"".$row["id"]."\">"."<div class=\"entryInfo clearfix\">"."<div class=\"statusWrapper\"><div class=\"status\"></div><div class=\"statusIcon\"></div></div>"."<h1>".$row["post_title"]."</h1>"."<div class=\"timeline-date entryDate\">".$row["post_date"]."</div>"."</div>"."<p contentEditable=\"true\">".$row["post_details"])."</p><a class=\"deleteBTN\"href='delete.php?id=".$row["id"]."'>x</a></li>";

        $bookwrite_row = mysql_fetch_array($result);
    }
} else {
    $class = "hideMe";
    $firstnameResult = mysql_query("SELECT * FROM users WHERE username = '$user' ", $connection);

    $row2 = mysql_fetch_array($firstnameResult);
    echo "<div class=\"platOptions welcome\"><div class=\"welcomeinfo\"><h1>Welcome!</h1>Welcome to Little Quill, ".$row2["firstName"].". We see you are new to the platform. To get started by adding your first post please click the \"New Entry\" button below <a class=\"newentryBTN\" href=\"newEntry.php\">New Entry</a></div></div>";
}
    if (mysql_num_rows($result)==0){
        $class = "hideMe";
...