-1
這就是我現在使用的。我成功獲取第一個查詢,但是我無法從第二個查詢中檢索任何數據。第二個查詢的所有變量都是未定義的。連續獲取MySQL數據的最佳方式?
$sql = "SELECT * FROM history WHERE ended=1 ORDER BY chance ASC LIMIT 1";
$result = $conn->query($sql);
$row = mysqli_fetch_assoc($result);
$luck_steamid = $row["winner"];
$luck_total = $row["total"];
$luck_chance = $row["chance"];
$luck_round = $row["id"];
$sql = "SELECT * FROM users WHERE steamid=".$luck_steamid;
$result = $conn->query($sql);
$row = mysqli_fetch_assoc($result);
$luck_avatar = $row["avatar"];
$luck_name = $row["name"];
$luck_profile = $row["profile"];
你爲什麼不使用JOIN –
您是否嘗試過呼應你的第二個查詢和自己運行它,以確保你應該回去數據? – RhoVisions