小编Pat*_*sen的帖子

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

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

<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 …
Run Code Online (Sandbox Code Playgroud)

html php mysql

-2
推荐指数
1
解决办法
2900
查看次数

标签 统计

html ×1

mysql ×1

php ×1