1 回答

TA貢獻1854條經驗 獲得超8個贊
可以先查詢位置。我還沒有運行它來測試它,但是像這樣的東西應該可以解決問題
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 關注
- 123 瀏覽
添加回答
舉報