MySQL只返回一个结果.我很困惑

Tap*_*pha 1 php mysql

这是te代码:

<?php

//Starting session

session_start();

//Includes mass includes containing all the files needed to execute the full script
//Also shows homepage elements without customs

require_once ('includes/mass.php');

$username = $_SESSION['username'];

if (isset($username))

{   

//Query database for the users networths

$sq_l = "SELECT * FROM user";

$sql_query_worth = mysql_query($sq_l);

while ($row = mysql_fetch_assoc($sql_query_worth))

      {

         $dbusername = $row['username'];


      } 

      echo $dbusername;

}
?>
Run Code Online (Sandbox Code Playgroud)

Tes*_*rex 11

你在回路之外回荡.所以它只是回应最后一排.将echo语句放在while循环中.