$exec="update xt set timesc = '".$end."' where id = $id"; 没报错,可以正常更新
但是一放到while($rs=mysql_fetch_object($result)) { 这里面就报 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in E:\web...................... }报while($rs=mysql_fetch_object($result))这一行错。 然后timesc这一列的所有数据就都更改成 第一个ID减出来的数
{
这里面就报 Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in E:\web......................
}报while($rs=mysql_fetch_object($result))这一行错。
然后timesc这一列的所有数据就都更改成 第一个ID减出来的数
改为
mysql_query($exec);
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
$id = "".$rs->id."";
$aaa="".$rs->t1."";
$bbb="".$rs->t2."";
$end=($bbb-$aaa);
$exec="update xt set timesc = '".$end."' where id = '$id'";
//这里的$result要改成$resutl2,$result已经在while中使用了
$result2=mysql_query($exec);
}
然后t1-t2=t3
然后更新这条记录的值为t3要批量更新,所以想在循环while里面做,但是这里面不知要怎么写更新语句
$result=mysql_query($exec);
都产生了结果集.楼主应区别一下!