2
這裏是4個字段之一是oprid,oprname,empid和另一個字段是電子郵件。我想oprid,oprname,EMPID或電子郵件,但它不工作搜索,搜索oracle數據庫使用php
警告:oci_fetch_array():ORA-24374:定義沒有做過讀取或執行,並獲取
<?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="0" 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>
<?
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);
}
?>
</body>
</html>
當我打開這個頁面的數據已經顯示在頁面中沒有搜索 –
確保代碼中的'如果(isset($ _ REQUEST [「提交」]) ){'阻止它只在搜索後執行。 – MrCode