這裏的一切正在工作,除了更新命令...插入工作正常,但唉,我卡住了。更新命令語法
$queryLastDateArray = "SELECT date FROM schedule ORDER BY ID DESC LIMIT 1";
$lastDateArray = mysql_query($queryLastDateArray);
while($row = mysql_fetch_array($lastDateArray))
{
$lastDate = $row['date'];
}
$lastDatePlusOne = date("Y-m-d", strtotime("+1 day", strtotime($lastDate)));
$newDatesArray = GetDays($lastDatePlusOne, $_POST[date]);
$i = 0;
while($i < count($newDatesArray))
{
if ((date('D', strtotime($newDatesArray[$i]))) == 'Fri')
{
$insDate = "INSERT INTO schedule (date) VALUES ('$newDatesArray[$i]')";
$result = mysql_query($insDate);
$insEmp = "UPDATE schedule SET schedule.jakes = schedule_default.jakes FROM schedule, schedule_default WHERE schedule.date = '$newDatesArray[$i]' AND schedule_default.ID = '5'";
$result2 = mysql_query($insEmp);
}
$i++;
}
切忌在對/而行再次使用'count'。放入一個變量並使用變量本身。 – Pentium10 2011-04-22 19:39:49
@ Pentium10 - 爲什麼不呢?除了不必要的微觀優化之外,還有一個原因嗎 – 2011-04-22 19:47:13
用於低延遲響應時間。 – Pentium10 2011-04-22 19:55:59