일요일이라면
본문
그런데 일요일에는 돌아가지 않게 하고 싶은데
이번주 일요일을 뽑는거 찾아보니
if(!$setdate)$setdate = date("Y-m-d");
$today = strtotime($setdate);
echo '<br />이번주 일요일 : '.$sun = date('Y-m-d', (strtotime('SUNDAY', $today) > $today) ? strtotime('LAST SUNDAY', $today) : strtotime('SUNDAY', $today)); // 이번주 일요일
이렇게 하니
- 이번주 일요일 : 2020-11-08 이렇게 뽑히는군요
이제 오늘이 일요일이라면
$today_search .= " and SUBSTR(wr_datetime,1,10)=CURDATE() "; //오늘 날짜만 보이기
sql_query("update g5_write_test set ca_name = '완료' where mb_id = 'admin' $today_search ORDER BY RAND() LIMIT 8"); //
위코드가 작동안하게 하려면 어떻게 해야 할까요?
고수님 도움을 기다려봅니다.
혹시 이렇게 해보면 될까요?
if(!$setdate)$setdate = date("Y-m-d");
$today = strtotime($setdate);
$sun = date('Y-m-d', (strtotime('SUNDAY', $today) > $today) ? strtotime('LAST SUNDAY', $today) : strtotime('SUNDAY', $today)); // 이번주 일요일
if(!$sun) {
$today_search .= " and SUBSTR(wr_datetime,1,10)=CURDATE() "; //오늘 날짜만 보이기
sql_query("update g5_write_test set ca_name = '완료' where mb_id = 'admin' $today_search ORDER BY RAND() LIMIT 8"); //
}