日期:2014-05-17 浏览次数:20570 次
$jg = array(1000, 2000, 3000); $sj = array(2001, 2002, 2003); if(isset($_GET['act'])) { $k = substr($_GET['act'], 3); unset($_GET['act']); if($k == 'all') $_GET = array(); else unset($_GET[$k]); } echo '<br>价格:'; $param = getparam('jg'); foreach($jg as $v) echo " <a href=?$param$v>$v</a>"; echo '<br>时间:'; $param = getparam('sj'); foreach($sj as $v) echo " <a href=?$param$v>$v</a>"; $param = http_build_query($_GET); echo "<p><a href=?act=deljg&$param>清除价格</a> <a href=?act=delsj&$param>清除时间</a> <a href=?act=delall&$param>全部清除</a>"; echo "<p>select * from tbl_name " . expr(); function getparam($k) { $param = $_GET; if(isset($_GET[$k])) unset($param[$k]); $param[$k] = ''; return http_build_query($param); } function expr($expr='and') { if(! $_GET) return ''; foreach($_GET as $k=>$v) $r[] = "$k='$v'"; return 'where ' . join(" $expr ", $r); }