时间:2021-07-01 10:21:17 帮助过:20人阅读
0) { $sql= "SELECT value FROM countries WHERE value LIKE '".$queryString."%' LIMIT 10"; $query = mysql_query($sql); while ($result = mysql_fetch_array($query,MYSQL_BOTH)){ $value=$result['value']; ?>
thinkphp中已经有封装好的函数可以用
public function query(){ $where = array(); $limit = 10; if(strlen($queryString)>0){ $where['value'] = array('like','%'.$queryString.'%'); } $list = M('test')->where($where)->limit($limit)->select(); //todo }
public function query(){ $where = array(); $limit = 10; if(strlen($queryString)>0){ $where['value'] = array('like','%'.$queryString.'%'); } $list = M('countries')->field('value')->where($where)->limit($limit)->select(); //todo }