我无法爆炸工作我有一个名为出席的表字段,其中多个用户 ID 用逗号 73、1、5 分隔现在我可以轻松地让用户 73 回显,但其余的需要爆炸,我希望它回显这 3 个用户的每个用户名或最终的用户名。我在想这可能是我用//注释掉的东西
参加字段是用户列表 http://imageshack.us/a/img38/1425/eventsne.jpg
一旦我的用户名在化身和表格中工作不正常,尝试像这样回显 http://imageshack.us/a/img819/8210/events2d.jpg
$Attending1 = array();
$Attending1 = mysql_query("SELECT * FROM Events, Users WHERE Events.Attending = Users.UserId");
//$AttendingUserIds = $Attending1['Attending'];
//$AttendingExploded = explode(",", $AttendingUserIds);
//$Attending3 = array();
//$Attending3 = mysql_query("SELECT * FROM Events, Users WHERE $AttendingExploded = Users.UserId");
while ($Attending2 = mysql_fetch_array($Attending1)) {
echo $Attending2['username'];
}
刚刚尝试了 KyleK 的第三个建议
$Attending1 = array();
$Attending1 = mysql_query("SELECT * FROM Events, Users WHERE Events.Attending = Users.UserId");
$AttendingUserIds = $Attending1['Attending'];
//$AttendingExploded = explode(",", $AttendingUserIds);
$Attending3 = array();
$Attending3 = mysql_query("SELECT * FROM Events, Users WHERE Users.UserId IN ($AttendingUserIds)");
它给了我警告:mysql_fetch_array():提供的参数不是 While 开始的有效 MySQL 结果资源。