gpt4 book ai didi

php - MySQL 只返回一个结果。我很困惑

转载 作者:行者123 更新时间:2023-11-29 03:49:42 25 4
gpt4 key购买 nike

这是代码:

<?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;

}
?>

最佳答案

你在循环外回显。所以它只是回应最后一行。将该 echo 语句放入您的 while 循环中。

关于php - MySQL 只返回一个结果。我很困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2434121/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com