第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何檢查是否已在 2 個日期之間收取租金

如何檢查是否已在 2 個日期之間收取租金

PHP
有只小跳蛙 2021-06-30 18:21:01
我正在嘗試比較租金開始和租金結(jié)束的兩個日期,但數(shù)據(jù)庫中的某些車輛可能已經(jīng)在這些日期租用我已經(jīng)有一個代碼阻止用戶在兩個日期之間預(yù)訂汽車,但在那之后它仍然被阻止if( empty($content) ){        extract($_POST); // here i extract my _post        if( !empty($idmembre) ){            $vehicule = execReq( "SELECT * FROM vehicule WHERE idvehicule=:idvehicule", array(                'idvehicule' => $idvehicule            ));            $infoVehicule = $vehicule->fetch();            $agence = $infoVehicule['agences_idagences'];            $timestamp1 = strtotime($date_heure_depart);            $timestamp2 = strtotime($date_heure_fin); // here i create two timestamps to compare with what i have en my database            $date_deja_prise = execReq( "SELECT * FROM commande WHERE vehicule_idvehicule=:idvehicule", array(                'idvehicule' => $idvehicule            ));            while( $date = $date_deja_prise->fetch() ){                if( !empty($date) ){ // here if one vehicle has a date of rent it checks evry one to check if the date is taken                    $date_debut = strtotime($date['date_heure_depart']);                    $date_fin = strtotime($date['date_heure_fin']);                    if( ($date_debut <= $timestamp1 || $timestamp2 <= $date_fin) ){                        $content .= '<div class="alert alert-danger">Le véhicule '.$infoVehicule['titre'].' est déjà louer du '.$date['date_heure_depart'].' au '.$date['date_heure_fin'].' inclu</div>';                    }                }            }所以基本上它可以在我的 phpmyadmin 頁面中創(chuàng)建一行,在那里預(yù)訂汽車一段時間,之后如果我嘗試預(yù)訂另一輛車,但所有日期都不同,我不能
查看完整描述

1 回答

?
森欄

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超5個贊

我認(rèn)為你的問題是這條線if( ($date_debut <= $timestamp1 || $timestamp2 <= $date_fin) ){。您只檢查新開始時間是否 <= 比現(xiàn)有開始時間,以及新結(jié)束時間是否 >= 比現(xiàn)有開始時間。您需要檢查開始日期或結(jié)束日期是否在現(xiàn)有日期之間。

if( ($date_debut <= $timestamp2 && $timestamp1 <= $date_fin) ){


查看完整回答
反對 回復(fù) 2021-07-02
  • 1 回答
  • 0 關(guān)注
  • 122 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號