gpt4 book ai didi

php - 尝试显示成员列表

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

出于某种原因,我试图在列表中显示数据库中的所有成员,以便在单击他们时访问他们的每个个人资料,但我只获得了列表中最后一个人的链接数据库,有什么帮助吗?

include_once "../../mysql_server/connect_to_mysql.php";

//This code is used to display friends in the box of friends
$sql = mysql_query("SELECT * FROM myMembers");
$numberofRows = mysql_num_rows($sql);

$memberDisplayList = 'There are ' . $numberofRows .' members<br /><br />';

while($row = mysql_fetch_array($sql)) {

$id = $row['id'];
$firstname = $row["firstname"];
$lastname = $row["lastname"];

/////// Mechanism to Display Pic. See if they have uploaded a pic or not
$check_pic = "../../members/$id/image01.jpg";
$default_pic = "../../members/0/image01.jpg";
if (file_exists($check_pic)) {
$user_pic = "<img src=\"$check_pic?$cacheBuster\" width=\"80px\" />";
} else {
$user_pic = "<img src=\"$default_pic\" width=\"80px\" />";
}

$memberDisplayList = '<a href="http://www.pathtosite.com/friends_page.php?id='. $id .'">' . $firstname .' '. $lastname .'</a><br />';
}
// ------- END WHILE LOOP FOR GETTING THE MEMBER DATA ---------

最佳答案

我认为而不是

$memberDisplayList = '<a href= (...etc)

您想输入

$memberDisplayList .= '<a href= (...etc)

这会将新链接附加到您的字符串中。

此外,您似乎没有在任何地方回显您的 $user_pic$memberDisplayList 字符串。

关于php - 尝试显示成员列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10438033/

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