查询当isdel字段等于0时的记录$strWhere="(isDel=\"0\") and Name like '% $strKeyWord %'";if ($strWhere!="0"){
$strSQL="select * from contract where".$strWhere;
}else{
$strSQL="select * from contract where (isDel=\"0\")";
}结果输出$strWhere 和 $strSQL 均为空,
提示:Warning: mssql_query() [function.mssql-query]: message: 第 1 行: 'where' 附近有语法错误。
大家帮忙看看是哪里写错了,谢谢
$strSQL="select * from contract where".$strWhere;
}else{
$strSQL="select * from contract where (isDel=\"0\")";
}结果输出$strWhere 和 $strSQL 均为空,
提示:Warning: mssql_query() [function.mssql-query]: message: 第 1 行: 'where' 附近有语法错误。
大家帮忙看看是哪里写错了,谢谢
$strWhere=" (isDel='0') and Name like '% $strKeyWord %'";<==注意前面要空一个字符。if ($strWhere!="0"){//你这个判断什么?判断$strWhere字符长度?
$strSQL="select * from contract where".$strWhere;
}else{
$strSQL="select * from contract where (isDel='0')";
}
select * from contract where
Warning: mssql_query() [function.mssql-query]: message: 第 1 行: 'where' 附近有语法错误。 (severity 15) in C:\Apache2\htdocs\contract\admin\Browse.php on line 83
$strWhere=" isDel='0' and Name like '% $strKeyWord %'";<==注意前面要空一个字符。if (!empty($strKeyWord)){//你这个判断什么?判断$strWhere字符长度?
$strSQL="select * from contract where".$strWhere;
}else{
$strSQL="select * from contract where isDel='0'";
}这个字段你已经定义有字符,所以永远不为空!