选择状态的代码我是这样写的,可是执行不了,提示语法错误 if %{$_REQUEST['zhuangtai']}%="完成" then $q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai='fin' order by busname asc"; elseif %{$_REQUEST['zhuangtai']}%="未完成" then $q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai='new' order by busname asc";
$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai='fin' order by busname asc"; //elseif %{$_REQUEST['zhuangtai']}%="未完成" then //$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai='new' order by busname asc";
$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai like '%{$_REQUEST['zhuangtai']}%' order by busname asc";
$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai like '%{$_REQUEST['zhuangtai']}%' order by busname asc";
$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai like '%{$_REQUEST ['zhuangtai']}%' バス名 asc で並べ替えます";
对$_REQUEST['banben'],$_REQUEST['xianlu'],$_REQUEST['zhuangtai']做相应的判断 例: $sqlstr = ""; if (!empty($_REQUEST['banben'])){ $sqlstr = " and banben like '%{$_REQUEST['banben']}%' "; } if (!empty($_REQUEST['xianlu'])){ $sqlstr .= " 行名 like '%{$_REQUEST['xianlu']}%' "; } 同理$_REQUEST['zhuangtai']
$q = "SELECT * FROM research where 1 = 1 $sqlstr order by busname asc";
if (!empty($_REQUEST['xianlu'])){ $sqlstr .= " および linename like '%{$_REQUEST['xianlu']}%' "; }
$q = "SELECT * FROM research where banben like '%{$_REQUEST['banben']}%' AND linename like '%{$_REQUEST['xianlu']}%' AND zhuangtai like '%{$_REQUEST['zhuangtai']}%' order by busname asc";