$clientname=$_POST['clientname'];
$techname=$_POST['techname'];
$currentstatus=$_POST['currentstatus'];
$time1=$_POST['time1'];
$time2=$_POST['time2'];
$recordcontent=$_POST['recordcontent'];
$topbandwidth=$_POST['topbandwidth'];
$initialstatus=$_POST['initialstatus'];
$createddate=$_POST['createddate'];echo $recordcontent;
echo $topbandwidth;
echo $initialstatus;
echo $createddate;//echo "$techname";
//echo "$currentstatus";
//echo $time1;
//echo $time2;
if($recordcontent!='')
{
$x="任务信息跟进记录";
echo $x;
}
else{$x==''; $rsc==''; $recordcontent=='';}
if($topbandwidth!='')
{
$y="任务带宽峰值记录";
echo $y;
}
else{$y==''; $rsd==''; $topbandwidth=='';}
if($createddate!='')
{
$sqla=mysql_query("select ".$createddate." from task where clientname='$clientname' and techname='$techname'"); $z="任务初始记录日期";
echo $z;
}
else{$z==''; $rsa==''; $createddate=='';}
if($initialstatus!='')
{
$sqlb=mysql_query("select ".$initialstatus." from task where clientname='$clientname' and techname='$techname'");
$w="任务初始状态记录";
echo $w;
}
else{$w==''; $rsb==''; $initialstatus=='';}
/////////time condition 1, both null
if ($time1=='' && $time2=='')
{if ($clientname!='all' && $techname!='all' && $currentstatus!='all')
///////////////////////where A,B,C
{
$sql1 = mysql_query("select clientname,techname,currentstatus,recorddate from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");$sqlc = mysql_query("select ".$recordcontent." from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");
$sqld = mysql_query("select ".$topbandwidth." from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");
echo"<center><table><tr><td>客户名称</td><td>技术负责人</td><td>任务历史状态记录</td><td>$w</td><td>任务历史记录日期</td><td>$z</td><td>$x</td><td>$y</td></tr>";while ($rs1=mysql_fetch_object($sql1) && $rsa=mysql_fetch_object($sqla) && $rsb=mysql_fetch_object($sqlb) && $rsc=mysql_fetch_object($sqlc) && $rsd=mysql_fetch_object($sqld))
{
echo '<tr><td>'.$rs1->clientname.'</td><td>'.$rs1->techname.'</td><td>'.$rs1->currentstatus.'</td><td>'.$rsb->initialstatus.'</td><td>'.$rs1->recorddate.'</td><td>'.$rsa->createddate.'</td><td>'.$rsc->recordcontent.'</td><td>'.$rsd->topbandwidth.'</td></tr>'; }
echo'</table></center>';报错:Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
$techname=$_POST['techname'];
$currentstatus=$_POST['currentstatus'];
$time1=$_POST['time1'];
$time2=$_POST['time2'];
$recordcontent=$_POST['recordcontent'];
$topbandwidth=$_POST['topbandwidth'];
$initialstatus=$_POST['initialstatus'];
$createddate=$_POST['createddate'];echo $recordcontent;
echo $topbandwidth;
echo $initialstatus;
echo $createddate;//echo "$techname";
//echo "$currentstatus";
//echo $time1;
//echo $time2;
if($recordcontent!='')
{
$x="任务信息跟进记录";
echo $x;
}
else{$x==''; $rsc==''; $recordcontent=='';}
if($topbandwidth!='')
{
$y="任务带宽峰值记录";
echo $y;
}
else{$y==''; $rsd==''; $topbandwidth=='';}
if($createddate!='')
{
$sqla=mysql_query("select ".$createddate." from task where clientname='$clientname' and techname='$techname'"); $z="任务初始记录日期";
echo $z;
}
else{$z==''; $rsa==''; $createddate=='';}
if($initialstatus!='')
{
$sqlb=mysql_query("select ".$initialstatus." from task where clientname='$clientname' and techname='$techname'");
$w="任务初始状态记录";
echo $w;
}
else{$w==''; $rsb==''; $initialstatus=='';}
/////////time condition 1, both null
if ($time1=='' && $time2=='')
{if ($clientname!='all' && $techname!='all' && $currentstatus!='all')
///////////////////////where A,B,C
{
$sql1 = mysql_query("select clientname,techname,currentstatus,recorddate from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");$sqlc = mysql_query("select ".$recordcontent." from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");
$sqld = mysql_query("select ".$topbandwidth." from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'");
echo"<center><table><tr><td>客户名称</td><td>技术负责人</td><td>任务历史状态记录</td><td>$w</td><td>任务历史记录日期</td><td>$z</td><td>$x</td><td>$y</td></tr>";while ($rs1=mysql_fetch_object($sql1) && $rsa=mysql_fetch_object($sqla) && $rsb=mysql_fetch_object($sqlb) && $rsc=mysql_fetch_object($sqlc) && $rsd=mysql_fetch_object($sqld))
{
echo '<tr><td>'.$rs1->clientname.'</td><td>'.$rs1->techname.'</td><td>'.$rs1->currentstatus.'</td><td>'.$rsb->initialstatus.'</td><td>'.$rs1->recorddate.'</td><td>'.$rsa->createddate.'</td><td>'.$rsc->recordcontent.'</td><td>'.$rsd->topbandwidth.'</td></tr>'; }
echo'</table></center>';报错:Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
//2.执行SQL语句时,都加上错误输出,比如:
$sql1 = mysql_query("select clientname,techname,currentstatus,recorddate from jobrecord where clientname = '$clientname' and techname = '$techname' and currentstatus = '$currentstatus'") OR die(mysql_error());
{
$sqla=mysql_query("select ".$createddate." from task where clientname='$clientname' and techname='$techname'");if($initialstatus!='')
{
$sqlb=mysql_query("select ".$initialstatus." from task where clientname='$clientname' and techname='$techname'");
while ($rs1=mysql_fetch_object($sql1) && $rsa=mysql_fetch_object($sqla) && $rsb=mysql_fetch_object($sqlb) && $rsc=mysql_fetch_object($sqlc) && $rsd=mysql_fetch_object($sqld))
之前加入:
echo "sql1:$sql1<br />sqla:$sqla<br />sqlb:$sqlb<br />sqlc:$sqlc<br />sqld:$sqld";
看一下都是些什么 或帖出结果
sql1:Resource id #5
sqla:Resource id #4
sqlb:
sqlc:Resource id #6
sqld:
客户名称 技术负责人 任务历史状态记录 任务初始状态记录 任务历史记录日期 任务初始记录日期 任务信息跟进记录 任务带宽峰值记录
sql1:Resource id #6
sqla:Resource id #4
sqlb:Resource id #5
sqlc:Resource id #7
sqld:Resource id #8
勾选了4个check box 后得出的结果,同时echo了变量的值