gpt4 book ai didi

PHP数组逻辑

转载 作者:行者123 更新时间:2023-11-30 01:26:59 24 4
gpt4 key购买 nike

如何设置一个包含 bool 值或测试分数的主题数组?

如果有人在某个科目的每项测试中都取得高分,我会尝试展示一枚金牌。

我希望我能更清楚地回答这个问题,但这里有一些代码可以帮助阐明:

$resTestsQryStr = "SELECT TestID, Subject FROM Tests
WHERE " . $edstr . " AND " . $plstr . " AND " . $levelStr . " GROUP BY Subject";
$resTests = mysql_query($resTestsQryStr);

while ($rowT=mysql_fetch_array($resTests))
{
$subject=$rowT['Subject'];
$tID=$rowT['TestID'];
$resScore= mysql_query("SELECT Score FROM CompletedTests WHERE UserNum = '$userNum' AND TestID = '$tID'");
$rowScore= mysql_fetch_array($resScore);
if ($rowScore['Score'] < 100){
$medalWinArray[$subject]= false;
break;
}
else
$medalWinArray[$subject]= true;
}

最佳答案

我认为应该这样做:

SELECT Subject, MIN(Score) >= 100 GoldMedal
FROM Tests t
JOIN Completed Tests c ON c.TestID = t.TestID
WHERE $edstr AND $plstr AND $level
AND c.userNum = '$userNum'
GROUP BY Subject

关于PHP数组逻辑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17892595/

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