dongmei3498
2013-10-10 07:29
浏览 61

使用多个字段搜索oracle数据库

I am using this code to serach database and I am using 4 fields in this code but this code does not serach database value. where problem in this code tell me plz edit my code for full working serach with 4 fields my code :

       <?php
      {
     include ('connection.php');
       if(isset($_REQUEST['submit'])){

     $optid = $_POST['OPRID'];
     $optdec = $_POST['OPRDEFNDESC'];
     $empid = $_POST['EMPLID'];
      $empmail = $_POST['EMAILID'];
       $query ="SELECT  * FROM OPERATOR WHERE OPRID LIKE '%".$optid."%'  
        or OPRDEFNDESC LIKE '%".$optdec."%' or EMPLID LIKE '%".$empid."%'
        or EMAILID LIKE '%".$empmail."%' "; 

        }
    else{
  $query="SELECT * FROM OPERATOR";
$objParse = oci_parse ($ora_conn, $query);
    }
   ?>

  <form action="multi.php" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
  <table width="500" border="1" align="center">  
 <tr>  
 <th>Operator ID
<input name="OPRID" type="text" id="OPRID" value="";>  
<tr>  
<th>Operator Name
 <input name="OPRDEFNDESC" type="text" id="OPRDEFNDESC" value="";>  
  <tr>  
 <th>Person ID
 <input name="EMPLID" type="text" id="EMPLID" value="";>  
 <tr>  
 <th>Email ID
 <input name="EMAILID" type="text" id="EMAILID" value="";>  
 <input type="submit" value="Search"></th>  
 </tr>  
 </table>  
  </form> 
  <table>
 <tr>
     <td>Operator ID</td>
    <td>Operator Name</td>
    <td>Person ID</td>
     <td>Email ID</td>
  </tr>
  <?  

  $success = oci_execute($objParse);
 //while($objResult = oci_fetch_array($objParse,OCI_BOTH)) 
 while($objResult = oci_fetch_array($objParse, OCI_RETURN_NULLS+OCI_ASSOC)) 

 {  

 ?>  
 <tr>  
  <td><div align="center"><?=$objResult["OPRID"];?></div></td>  
  <td><?=$objResult["OPRDEFNDESC"];?></td>  
  <td><?=$objResult["EMPLID"];?></td>  
  <td><div align="center"><?=$objResult["EMAILID"];?></div></td> 
  <td align="center"><a  href="Optr_Edit.php?OprID= 

  <?=$objResult["OPRID"];?>">Edit</a></td> 
  </tr>  
   <?  
    }  
    ?>  
  </table>  
  <?  
 oci_free_statement($objParse);
  oci_close($ora_conn); 
  }
  ?>  
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • dqkxo44488 2013-10-10 07:35
    已采纳

    Try like this

    <tr>
      <td><div align="right"><strong>Password&nbsp;Encrypted:</strong></div></td>
      <td>
          <select name="txtENCRYPTED">
              <option value="">Select</option>
                  <option <?php if ($objResult["ENCRYPTED"] == "Y") {echo 'selected';} ?>value="Y">Y</option>
        <option <?php if ($objResult["ENCRYPTED"] == "N") {echo 'selected';} ?> value="N">N</option>      
          </select>
       </td>
    </tr> 
    
    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题