在下今天遇到一个问题,用 SQL 查询出很多行的数据,
然后呢,需要对其中两列的数据做操作,然后显示操作后的结果
不知到这个要怎么做
查询的结果 存与 一个 $BugList 变量中,里面有 2列表示时间的值
tstart 和 tend ,然后需要知道这个时间差但不知道要怎么循环来得到每列的时间差,
还有就是要怎么把操作的结果 再次 存 到 $BugList 这个变量的 tstart 单元中 $returndate1 = $BugList.tend;
$returndate2 = $BugList.tstart;
$Date_List_1=explode("-",$returndate1);
$Date_List_2=explode("-",$returndate2);
$d1=mktime(0,0,0,$Date_List_1[1],$Date_List_1[2],$Date_List_1[0]);
$d2=mktime(0,0,0,$Date_List_2[1],$Date_List_2[2],$Date_List_2[0]);
$BugList[tstart] = round(($d1-$d2)/3600/24); 这样可以不呢
然后呢,需要对其中两列的数据做操作,然后显示操作后的结果
不知到这个要怎么做
查询的结果 存与 一个 $BugList 变量中,里面有 2列表示时间的值
tstart 和 tend ,然后需要知道这个时间差但不知道要怎么循环来得到每列的时间差,
还有就是要怎么把操作的结果 再次 存 到 $BugList 这个变量的 tstart 单元中 $returndate1 = $BugList.tend;
$returndate2 = $BugList.tstart;
$Date_List_1=explode("-",$returndate1);
$Date_List_2=explode("-",$returndate2);
$d1=mktime(0,0,0,$Date_List_1[1],$Date_List_1[2],$Date_List_1[0]);
$d2=mktime(0,0,0,$Date_List_2[1],$Date_List_2[2],$Date_List_2[0]);
$BugList[tstart] = round(($d1-$d2)/3600/24); 这样可以不呢
$d1=mktime(0,0,0,$Date_List_1[1],$Date_List_1[2],$Date_List_1[0]);
$d2=mktime(0,0,0,$Date_List_2[1],$Date_List_2[2],$Date_List_2[0]);
$BugList[tstart] = round(($d1-$d2)/3600/24);
可以。