Heim >Backend-Entwicklung >PHP-Tutorial > 像这么的查询还有别的什么方法可写吗
像这样的查询还有别的什么方法可写吗?
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->public function find() { $sql = "SELECT * FROM qsj_user_profile RIGHT JOIN qsj_user ON qsj_user.uid = qsj_user_profile.uid"; if(!empty($_GET['email'])) { $sql.="AND qsj_user.email=".$_GET['email']; } if(!empty($_GET['nickname'])) { $sql.="AND qsj_user_profile.nickname = ".$_GET['nickname']; } if(!empty($_GET['province'])) { $sql.="AND qsj_user_profile.province =".$_GET['province']; } if(!empty($_GET['city'])) { $sql.="AND qsj_user_profile.city =".$_GET['city']; } if(!empty($_GET['dist'])) { $sql.="AND qsj_user_profile.dist = ".$_GET['dist']; } if(!empty($_GET['style'])) { $sql.="AND qsj_user_profile.style =".$_GET['style']; } $query = $this->db->query($sql); return $query->result_array(); }