"") { $H_debut = strtotime($hhdebut); } if ($hhfin <> "") $H_fin = strtotime($hhfin); $partie_dTmp = explode("/", $dTmp); /****************Ajouté pour eviter redondnce**********/ $jour= $partie_dTmp[1]; $mois= $partie_dTmp[0]; // mon ajout $annee= $partie_dTmp[2]; /**********************************************************************/ $strSQL = "SELECT * FROM EventsOccur WHERE dt_occur =".$annee."-".$mois."-".$jour.""; $strSQL =$strSQL." AND location = ".(int)($salleid).""; $rs = mysql_query($strSQL); if (!$rs) { echo "Could not successfully run query ($strSQL) from DB: ".mysql_error(); exit; } $blnLoop=false; while (($row = mysql_fetch_assoc($rs)) || (!$blnLoop)) { If (($H_debut >= $row["tm_start"]) AND ($H_fin <= $row["tm_end"]) OR ( $H_debut >= $row["tm_start"]) AND ($H_debut < $row["tm_end"]) OR ( $H_debut < $row["tm_start"]) AND ($H_fin > $row["tm_start"])) { $blnReserve=true; $blnLoop=true; } } mysql_free_result($rs); $verification=$blnReserve; return($verification); } //************************************************************************************************ function verificationUpdate($salleid,$hhdebut,$hhfin,$dTmp,$event_id) { $blnReserve=false; $blnLoop=false; $hhdebut=$hhdebut.": 00"; $hhfin=$hhfin.": 00"; $H_debut = strtotime($hhdebut); $H_fin = strtotime($hhfin); $dTmpoccur=explode("-",$dTmp); $dTmpoccur=mktime(0, 0, 0, $dTmpoccur[2],$dTmpoccur[1],$dTmpoccur[0]); // $strSQL = "SELECT CAST(DATE(dt_occur) AS CHAR) FROM EventsOccur "; $strSQL = "SELECT * FROM EventsOccur" WHERE ((UNIX_TIMESTAMP(dt_occur) = ".$dTmpoccur."))" AND (event_id <> ".$event_id.") AND (location=".(int)$salleid."))"; $rs = mysql_query($strSQL); if (!$rs) { echo "Could not successfully run query ($strSQL) from DB: " .mysql_error(); exit; } $blnLoop=false; echo "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh"; while (($row = mysql_fetch_assoc($rs)) || (!$blnLoop)) { print_r($row); echo "hello"; If (($H_debut >= $row["tm_start"]) AND ($H_fin <= $row["tm_end"]) OR ( $H_debut >= $row["tm_start"]) AND ($H_debut < $row["tm_end"]) OR ( $H_debut < $row["tm_start"]) AND ($H_fin > $row["tm_start"])) { echo "bonjour"; $blnReserve=true; $blnLoop=true; } } $blnReserve=true; mysql_free_result($rs); $verificationUpdate=$blnReserve; return($verificationUpdate); } ?>