我有这个查询调用:
$currplayer = 1;
$query = "SELECT f.fk_user_id2, u.username, u.profileimg FROM ".$prefix."_friends f
INNER JOIN ".$prefix."_users u
ON f.fk_user_id2 = u.id
WHERE f.fk_user_id1 = $currplayer ORDER BY u.username ASC";
if ($result = $mysqli->query($query)){
while ($row1 = $result->fetch_assoc()){
$friendid = $row1['fk_user_id2'];
$sql = $mysqli->query("SELECT * FROM ".$prefix."_newversus WHERE fk_player=$currplayer AND fk_opponent=$friendid");
$row = $sql->fetch_assoc();
我试图弄清楚如何将循环内的查询放入带有内部连接的第一个查询中,但无法弄清楚。
希望得到帮助并提前感谢:-)