我正在尝试使用多个输入字段搜索 oracle 数据库的代码以及此代码中的错误以及需要更改的地方请解释您的代码,因为我是编程新手......谢谢
我的代码:
$cond_string = "";
if(!empty($_GET['OPRID']))
{
$cond_string .= " AND OPRID LIKE '%".$_GET['OPRID']."%'";
}
if(!empty($_GET['OPRDEFNDESC']))
{
$cond_string .= " AND OPRDEFNDESC LIKE '%".$_GET['OPRDEFNDESC']."%'";
}
if(!empty($_GET['EMAILID ']))
{
$cond_string .= " AND EMAILID LIKE '%".$_GET['EMAILID']."%'";
}
if(!empty($_GET['EMPLID']))
{
$cond_string .= " AND EMPLID LIKE '%".$_GET['EMPLID']."%'";
}
$query ="SELECT * FROM OPERATOR WHERE(OPRID LIKE '%".$_GET["OPRID"]."%'
or OPRDEFNDESC LIKE '%".$_GET["OPRDEFNDESC"]."%' or EMPLID LIKE
'%".$_GET["EMPLID"]."%'
or EMAILID LIKE '%".$_GET["EMAILID"]."%') ";
$objParse = oci_parse ($ora_conn, $query);
$objResult = oci_execute ($objParse,OCI_DEFAULT);
?>
</br>
</br>
</br>
<table width="500" border="1" align="center">
<tr>
<th width="98"> <div align="center">Operator ID:</div></th>
<th width="98"> <div align="center">Operator Name:</div></th>
<th width="98"> <div align="center">Person ID:</div></th>
<th width="98"> <div align="center">Email ID:</div></th>
<th width="98"> <div align="center">Edit:</div></th>
</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>