PHP查询未在html表中显示所有结果

Pat*_*sen -2 html php mysql

所以我有以下查询来显示我的数据库中的所有用户:

<ul class="names">
                    <table>
                        <tr>
                            <th>Navn</th>
                            <th>Email</th>
                            <th>Score</th>
                        </tr>
                    <?php
                    $connection = mysql_connect('localhost', 'users', 'password'); //The Blank string is the password
                    mysql_select_db('users');

                    $query = ("SELECT * FROM oneusers"); //You don't need a ; like you do in SQL
                    $result = mysql_query($query);

                    $row=mysql_fetch_array($result);

                    while($row = mysql_fetch_array($result)){   //Creates a loop to loop through results
                    echo "<tr><td>" . $row['iUserName'] . "</td><td>" . $row['iUserEmail'] . "</td><td>" . $row['iUserCash'] . " DKK</td></tr>";  //$row['index'] the index here is a field name
                    }

                    mysql_close(); //Make sure to close out the database connection
                    ?>
                    </table>
                </ul>
Run Code Online (Sandbox Code Playgroud)

但由于某种原因,它并没有显示所有数据.

仅显示具有iUserId 2的用户而不是一个用户.

有没有人知道什么可能是错的?

我可以使用iUserId 1的凭据登录,并在登录页面上显示正确的信息.

但不是这里:S

u_m*_*der 7

删除行 $row = mysql_fetch_array($result);

因为此行开始从查询结果中提取记录.首先获取的记录是带有id的记录,1你不做任何事情.

然后你开始echo其他记录,但1已经跳过了带有id的记录.