【发布时间】:2016-06-15 07:02:06
【问题描述】:
if(isset($_REQUEST['submit']))
{
$desg=$_POST['desg'];
$cities=$_POST['cities'];
$exp=$_POST['exp'];
$prof=$_POST['prof'];
$sql="SELECT * FROM adjob WHERE desg like '%".$desg."%' OR cities like '%".$cities."%' OR exp like '%".$exp."%' OR prof like '%".$prof."%'";
$q=mysqli_query($con, $sql);
}
else
{
$sql="SELECT * FROM adjob";
$q=mysqli_query($con, $sql);
}
<form method="post">
<table width="200" border="1">
<tr>
<td>Desgination</td>
<td><input type="text" name="desg" value="" /></td>
<td>City</td>
<td><input type="text" name="cities" value="" /></td>
<td>Experince</td>
<td><input type="text" name="exp" value="" /></td>
<td>Profile</td>
<td><input type="text" name="prof" value="" /></td>
<td><input type="submit" name="submit" value="Find" /></td>
</tr>
</table>
</form>
<table>
<tr>
<td>Desg</td>
<td>Cities</td>
<td>Exp</td>
<td>Prof</td>
</tr>
<?php
while($res=mysqli_fetch_array($q)){
?>
<tr>
<td><?php echo $res['desg']; ?></td>
<td><?php echo $res['cities']; ?></td>
<td><?php echo $res['exp']; ?></td>
<td><?php echo $res['prof']; ?></td>
</tr>
<?php }?>
</table>
我正在使用此代码从表中进行搜索。我必须填写 4 个字段才能获取一行的数据。我如何填写两个或三个字段并匹配数据库和搜索数据中的列(我们在各种工作门户中搜索的方式)?提前谢谢_/_
【问题讨论】: