中sql语句不能正常执行是怎么回事
//表单:<selectname="select"><optionvalue="id">员工ID</option><optionvalue="name"selected>...
//表单:
<select name="select" >
<option value = "id" >员工ID</option>
<option value = "name" selected>姓名</option>
<option value = "decscription">部门</option>
</select>
//执行文件
$sele=$_POST["select"];echo $sele;
$cond=$_POST["text"];echo $cond;
if($sele=='id')
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id and staff_info.id='".$cond."';;";
}
if($sele=='name')
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id staff_info.name='".$cond."';";
}
else
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id and depart_info.description='".$cond."';";
}
执行的记录集为空,为什么??? 展开
<select name="select" >
<option value = "id" >员工ID</option>
<option value = "name" selected>姓名</option>
<option value = "decscription">部门</option>
</select>
//执行文件
$sele=$_POST["select"];echo $sele;
$cond=$_POST["text"];echo $cond;
if($sele=='id')
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id and staff_info.id='".$cond."';;";
}
if($sele=='name')
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id staff_info.name='".$cond."';";
}
else
{
$query="select id,name,description from staff_info,depart_info where staff_info.depart_id=depart_info.depart_id and depart_info.description='".$cond."';";
}
执行的记录集为空,为什么??? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询