我的程序是这样写的,哪位能帮我看看: @$SQL="select * from company where chrCompanyName like '%$txtCompany%'"; if(!empty($selAreaID)&&$selAreaID<>0) { $SQL=$SQL."and chrAreaID='$selAreaID' "; } if(!empty($selTypeID)&&$selTypeID<>0) { $SQL=$SQL."and chrType='$selTypeID'"; } if(!empty($txtAddress)) { $SQL=$SQL."and chrAddress like '%$txtAddress%' "; } if(!empty($txtPhone)) { $SQL=$SQL."and chrPhone like '%$txtPhone%'"; } if(!empty($txtFax)) { $SQL=$SQL."and chrFax like '%$txtFax%' "; } if(!empty($txtEmail)) { $SQL=$SQL."and chrEmail like '%$chrEmail%' "; } if(!empty($txtZipeCode)) { $SQL=$SQL."and chrZipeCode like '%$txtZipeCode%' "; }if(!empty($selProperty)&&$selProperty<>0) { $SQL=$SQL."and chrProperty='$selProperty' "; } if(!empty($txtMoney)) { $SQL=$SQL."and numMoney like '%$txtMoney%'"; } if(!empty($txtCorporate)) { $SQL=$SQL."and chrCorporate like '%$txtCorporate%'"; } $SQL=$SQL."order by dtmDate desc";$res1=mysql_query($SQL); $numCols=mysql_num_rows($res1);
@$SQL="select * from company where chrCompanyName like '%$txtCompany%' "; if(!empty($selAreaID)&&$selAreaID<>0) { $SQL=$SQL." and chrAreaID='$selAreaID' "; } if(!empty($selTypeID)&&$selTypeID<>0) { $SQL=$SQL." and chrType='$selTypeID'"; } if(!empty($txtAddress)) { $SQL=$SQL." and chrAddress like '%$txtAddress%' "; } if(!empty($txtPhone)) { $SQL=$SQL." and chrPhone like '%$txtPhone%'"; } if(!empty($txtFax)) { $SQL=$SQL." and chrFax like '%$txtFax%' "; } if(!empty($txtEmail)) { $SQL=$SQL." and chrEmail like '%$chrEmail%' "; } if(!empty($txtZipeCode)) { $SQL=$SQL." and chrZipeCode like '%$txtZipeCode%' "; }if(!empty($selProperty)&&$selProperty<>0) { $SQL=$SQL." and chrProperty='$selProperty' "; } if(!empty($txtMoney)) { $SQL=$SQL." and numMoney like '%$txtMoney%'"; } if(!empty($txtCorporate)) { $SQL=$SQL." and chrCorporate like '%$txtCorporate%'"; } $SQL=$SQL." order by dtmDate desc";$res1=mysql_query($SQL); $numCols=mysql_num_rows($res1);注意多加个空格,如果不行,你可以输出SQL语句看看
@$SQL="select * from company where chrCompanyName like '%$txtCompany%'";
if(!empty($selAreaID)&&$selAreaID<>0)
{
$SQL=$SQL."and chrAreaID='$selAreaID' ";
}
if(!empty($selTypeID)&&$selTypeID<>0)
{
$SQL=$SQL."and chrType='$selTypeID'";
}
if(!empty($txtAddress))
{
$SQL=$SQL."and chrAddress like '%$txtAddress%' ";
}
if(!empty($txtPhone))
{
$SQL=$SQL."and chrPhone like '%$txtPhone%'";
}
if(!empty($txtFax))
{
$SQL=$SQL."and chrFax like '%$txtFax%' ";
}
if(!empty($txtEmail))
{
$SQL=$SQL."and chrEmail like '%$chrEmail%' ";
}
if(!empty($txtZipeCode))
{
$SQL=$SQL."and chrZipeCode like '%$txtZipeCode%' ";
}if(!empty($selProperty)&&$selProperty<>0)
{
$SQL=$SQL."and chrProperty='$selProperty' ";
}
if(!empty($txtMoney))
{
$SQL=$SQL."and numMoney like '%$txtMoney%'";
}
if(!empty($txtCorporate))
{
$SQL=$SQL."and chrCorporate like '%$txtCorporate%'";
}
$SQL=$SQL."order by dtmDate desc";$res1=mysql_query($SQL);
$numCols=mysql_num_rows($res1);
if(!empty($selAreaID)&&$selAreaID<>0)
{
$SQL=$SQL." and chrAreaID='$selAreaID' ";
}
if(!empty($selTypeID)&&$selTypeID<>0)
{
$SQL=$SQL." and chrType='$selTypeID'";
}
if(!empty($txtAddress))
{
$SQL=$SQL." and chrAddress like '%$txtAddress%' ";
}
if(!empty($txtPhone))
{
$SQL=$SQL." and chrPhone like '%$txtPhone%'";
}
if(!empty($txtFax))
{
$SQL=$SQL." and chrFax like '%$txtFax%' ";
}
if(!empty($txtEmail))
{
$SQL=$SQL." and chrEmail like '%$chrEmail%' ";
}
if(!empty($txtZipeCode))
{
$SQL=$SQL." and chrZipeCode like '%$txtZipeCode%' ";
}if(!empty($selProperty)&&$selProperty<>0)
{
$SQL=$SQL." and chrProperty='$selProperty' ";
}
if(!empty($txtMoney))
{
$SQL=$SQL." and numMoney like '%$txtMoney%'";
}
if(!empty($txtCorporate))
{
$SQL=$SQL." and chrCorporate like '%$txtCorporate%'";
}
$SQL=$SQL." order by dtmDate desc";$res1=mysql_query($SQL);
$numCols=mysql_num_rows($res1);注意多加个空格,如果不行,你可以输出SQL语句看看
或者说sql语句有问题,检查一下相关的select语句
程序设计得不严密,这样的错误程序里面应该捕捉的....