문제는 내 변수 $target_time
이 제대로 작동하지 않는다는 것입니다.양식 제출 후 변수가 변경되지 않습니다
if (isset($_POST['bid'])) {
$stmt10->execute(array(
'user_id' => $usid,
'user' => $login,
'bid' => $_SESSION['bid']
));
}
$target_time = strtotime('+15 minutes', strtotime($stmt14));
$current_time = time();
echo $current_time . ' >= ' . $target_time;
$seconds_left = $target_time - $current_time;
$minutes_left = floor($seconds_left/60);
$seconds_left -= $minutes_left * 60;
$seconds_left = floor($seconds_left);
if ($current_time >= $target_time) {
$stmt9->execute();
$r1 = $stmt9->fetch(PDO::FETCH_ASSOC);
$stmt12->execute();
$r2 = $stmt12->fetch(PDO::FETCH_ASSOC);
$stmt11->execute(array(
'win' => $r1['bid'],
'user_id' => $r2['user_id']
));
$stmt13->execute(); // Clears bid table
}
사용자 프레스 제출 버튼을, 이름 bid
는 if (isset($_POST['bid'])) {
의해 실행되지만 $target_time
가 $current_time
이상 아니고, 단지 대신 양식 제출 15 분을 추가 1470996804 >= 900
을 실행하는 요소 값 날짜. if ($current_time >= $target_time) {
조건에 해당하는 1470996804 >= 900
의 결과를 제공하므로 양식을 제출 한 직후에 실행 중이며 $stmt13->execute();
이 실행되므로 모든 테이블 내용이 제거됩니다. 양식을 제출할 때 어떻게해야합니까? $target_time
은 데이터베이스에서 가져오고 if ($current_time >= $target_time) {
조건은 즉시 적용되지 않지만 제출 버튼을 누른 후 15 분 후에 만 실행됩니까?
나는 당신이 무엇을 요구하는지 이해하기 위해 애 쓰고 있습니다. 사용자가 양식을 제출 한 후 15 분 후에 쿼리를 실행 하시겠습니까? – BadHorsie
예, 정확히 원하는 것입니다. – Luke
15 분 지연 대신 사용자가 양식을 제출 한 후에 오류가 표시되지 않습니다. – Luke