用表的连接.from table1,table2......加你的条件.

解决方案 »

  1.   

    写一 sql 语句,
    判断条件:如果选择了该条件,把条件串入 sql 语句
      

  2.   

    <?
     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>
    <? }
     ?>