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 关注
- 137 浏览
添加回答
举报