-
-
Save IMSoP/ff8733294b82299fc09e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function insert_booking_date_match(Array $dates, $rule_id) | |
{ | |
$sql = "-- insert_booking_date_match | |
BEGIN; | |
DELETE FROM | |
rule_booking_date_match | |
WHERE | |
rule_id = ".$rule_id." | |
; | |
"; | |
foreach ( $dates as $date ) | |
{ | |
if( $date != null ) | |
{ | |
$sql .= " | |
INSERT INTO | |
rule_booking_date_match(rule_id,date_from,date_to) | |
VALUES( | |
".$rule_id." | |
, | |
'".date('Y-m-d',$date['from'])."' | |
, | |
'".date('Y-m-d',$date['to'])."' | |
);"; | |
} | |
} | |
$sql .= "COMMIT;"; | |
$result = $this->db->query($sql); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment