需求是这样的:页面有两个SELECT框,一个是IP,一个是姓名,要求SELECT语句是根据这两个SELECT框随机显示的,例:如果我只选择IP:select ip from biao group by ip
如果我只选择姓名:select name from biao group by name
如果两个都选:select ip,name from biao group by ip,name所以我就将两个SELECT框定义成数组的形式arg[],
foreach($arg as $key => $value){
$groupby[] = $key;
}
select ".implode(',', $groupby)." group by ".implode(',', $groupby)."页面显示的时候也要随机显示
$count_num=count($groupby);//统计选择了多少项
while($data = mysql_fetch_array($query)){
printf("<tr>");
for($i=0;$i<$count_num;$i++){
$format = "<a href=\"javascript: window.open('View.php?id=$data[$i]&part_name=$groupby[$]','_blank');void(0);\">%s</a>" : "%s";
printf("<td nowrap>$format</font></td>",$data[$i]); }关键问题:循环显示的td加上连接,将值传给View.php,如果选择了IP和name,
页面显示
IP name
192.168.1.1 color无论点IP的超连接还是name的超连接都要将192.168.1.1和color这两个字段及值都传给View.php,而我现在TD是循环的,只能将该选中的连接的字段和值传过去,请问高手有什么办法解决吗?谢谢
如果我只选择姓名:select name from biao group by name
如果两个都选:select ip,name from biao group by ip,name所以我就将两个SELECT框定义成数组的形式arg[],
foreach($arg as $key => $value){
$groupby[] = $key;
}
select ".implode(',', $groupby)." group by ".implode(',', $groupby)."页面显示的时候也要随机显示
$count_num=count($groupby);//统计选择了多少项
while($data = mysql_fetch_array($query)){
printf("<tr>");
for($i=0;$i<$count_num;$i++){
$format = "<a href=\"javascript: window.open('View.php?id=$data[$i]&part_name=$groupby[$]','_blank');void(0);\">%s</a>" : "%s";
printf("<td nowrap>$format</font></td>",$data[$i]); }关键问题:循环显示的td加上连接,将值传给View.php,如果选择了IP和name,
页面显示
IP name
192.168.1.1 color无论点IP的超连接还是name的超连接都要将192.168.1.1和color这两个字段及值都传给View.php,而我现在TD是循环的,只能将该选中的连接的字段和值传过去,请问高手有什么办法解决吗?谢谢
解决方案 »
- selection的一些问题
- 请问javascript能不能控制当浏览器窗口处于非活动状态时闪烁?
- 这段代码四级边动的在IE8,FF下不支持,大家帮忙看看!谢谢,在线等!
- 字符替换问题
- 求一个点本贴右下角“举报”弹出一个DIV,页面变灰的JS!
- js有关窗口关闭与刷新问题,问题解决必感谢!
- 为什么我看的javascript的书都没有介绍过try{}catch{}这样的语法的?
- 大哥们,帮帮小妹把,下面这个动态效果如何实现
- 写一个正则,匹配不包含特殊字符 ' 该怎么写
- js报错Uncaught SyntaxError: missing ) after argument list
- 关于JS里面页面的刷新问题
- javascript 如何写一个鹰眼程序啊
$sql=$ip.' , '.$name;
}elseif(isset($name)){
$sql=$name;}
elseif(isset($ip)){
$sql=$ip;
}select $sql from biao group by $sql;