function query($sql) {
$this->result = @mysql_query($sql, $this->conn);
return($this->result != false);
}
function convert(){
$这 - > DB->打开();
$sql_update =“”;
$this-> db-> query(“SELECT * FROM ACCOUNTS”);
$str ='';
while($row = $this-> db-> fetchassoc()){
$jobNum = $row ['JOBNUMBER'];
$old_date = $row ['INSTALLDATE'];
$new_date = date(“Y-m-d”,strtotime($old_date));
$sql_update =“UPDATE ACCOUNTS SET INSTALLDATE ='$new_date'WHERE JOBNUMBER ='$jobNum'”;
// $this-> db-> query($sql_update)或die($this-> response-> throwResponseError(MSG_DATABASE_ERROR.mysql_error()));
$str.= $jobNum. “ - ”. $new_date. “”;
}
return $str;
}
如果我用注释掉的那一行运行它,它会返回我想要的所有结果.但是当我取消注释它实际运行更新的行时,它会更新第一条记录并停止循环.为什么?