1 回答

TA貢獻(xiàn)1854條經(jīng)驗(yàn) 獲得超8個(gè)贊
可以先查詢位置。我還沒有運(yùn)行它來測(cè)試它,但是像這樣的東西應(yīng)該可以解決問題
class Information extends DB {
function get(){
$loc=$_GET['loc'];
$locationResults = $this->select("SELECT location FROM corona WHERE location= '$loc'");
if ($locationResults->num_rows == 0) {
echo "If the number of rows returned is equal to 0, then there's no locations for the location the user gave";
} else {
return $this->select("SELECT location, MAX(population), MAX(total_deaths_per_million), MAX(total_cases), MAX(total_deaths), MAX(total_cases_per_million) FROM corona WHERE location= '$loc'");
}// end else
}//end function
}//end class
- 1 回答
- 0 關(guān)注
- 122 瀏覽
添加回答
舉報(bào)