请问多表搜索怎么实现? 用表的连接.from table1,table2......加你的条件. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写一 sql 语句,判断条件:如果选择了该条件,把条件串入 sql 语句 <? if($submit) { if($checkbox_title)$where1.=" title like %$keyword%"; if($checkbox_text)$where1.=" or text like %$keyword%"; if($checkbox_a)$from1.="from $checkbox_a"; if($checkbox_b)$from1.=",$checkbox_b"; if($checkbox_c)$from1.=",$checkbox_c"; if($checkbox_d)$from1.=",$checkbox_d"; $query="select title $from1 where $where1"; } else{?> <form name="form1" method="post" action=""> <input type="text" name="keyword"> 关键字 按<input type="checkbox" name="checkbox_title" value="checkbox"> 题目 <input type="checkbox" name="checkbox_text" value="checkbox"> 内容 搜索位置 <input type="checkbox" name="checkbox_a" value="checkbox"> A <input type="checkbox" name="checkbox_b" value="checkbox"> B <input type="checkbox" name="checkbox_C" value="checkbox"> C <input type="checkbox" name="checkbox_d" value="checkbox"> D <INPUT TYPE="submit" value="提交"></form><? } ?> PHP函数应用 数据库分类查询问题 是否可以不使用js,实现点击超链接提交表单? php方法参数问题 问一下phplib的循环嵌套的问题. 如何用javascript来判断PHP动态生成的Form PHP开发工具 is_array判断不起作用 询问大家两个初级问题 图像如何以数据流的方式传输到客户端 连接异地ORACLE? php图片上写汉字的问题,急~~~~~
判断条件:如果选择了该条件,把条件串入 sql 语句
if($submit)
{
if($checkbox_title)$where1.=" title like %$keyword%";
if($checkbox_text)$where1.=" or text like %$keyword%";
if($checkbox_a)$from1.="from $checkbox_a";
if($checkbox_b)$from1.=",$checkbox_b";
if($checkbox_c)$from1.=",$checkbox_c";
if($checkbox_d)$from1.=",$checkbox_d";
$query="select title $from1 where $where1";
}
else{?>
<form name="form1" method="post" action="">
<input type="text" name="keyword">
关键字 按
<input type="checkbox" name="checkbox_title" value="checkbox">
题目
<input type="checkbox" name="checkbox_text" value="checkbox">
内容 搜索位置
<input type="checkbox" name="checkbox_a" value="checkbox">
A
<input type="checkbox" name="checkbox_b" value="checkbox">
B
<input type="checkbox" name="checkbox_C" value="checkbox">
C
<input type="checkbox" name="checkbox_d" value="checkbox">
D
<INPUT TYPE="submit" value="提交">
</form>
<? }
?>