-1
我試圖從殺死數據庫中找到最好的殺手(大多數殺手)。 將$ important的killerId放入數組中,並將其與其他殺手進行比較。找到武器最重要的殺手。 我該怎麼做?使用特定武器殺死玩家最多[mysql]
$array = array();
$index = 0;
while($mData = $q->fetch_assoc())
{
$index++;
$arr = explode('with ', $mData['killText']);
$unimportant = array(" (in paintball)", " (in event)");
$important = str_replace($unimportant, "", $arr[1]);
if(empty($important)) { $important = "Suicide"; }
$array[$important]['Kills']++;
$array[$important]['Gun'] = $important;
$query2 = $mysql->query("SELECT * FROM `kills` WHERE `killText` LIKE '%$important%' AND `killerID` = '". $mData['killerID'] ."'") or die($mysql->error);
while($kData = $query2->fetch_assoc())
{
// put the killerId of $important into an array, and compare it with the rest of the killers. Find the best killer with the weapon $important
}
}
提示:把一個MySQL在另一個查詢結果的'while'循環中查詢幾乎總是一個你需要了解'JOIN'的標誌。 –