Last active
June 12, 2018 15:15
-
-
Save Chillifish/8ddfcc2867aca596c4b60f7b35798e4c to your computer and use it in GitHub Desktop.
Script check method
This file contains hidden or 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
public function scriptCheck() { | |
global $wpdb; | |
$wnumber = $this->getWNumber(); | |
$booking_status = $wpdb->get_results("SELECT completed FROM " . $wpdb->prefix . "ch_bookings WHERE booking = " . $wnumber, ARRAY_A); | |
if (is_array($booking_status)) { | |
if ($booking_status[0]["completed"] == 1) { | |
return true; | |
} | |
} | |
else { | |
$wpdb->insert($wpdb->prefix . 'ch_bookings', | |
array( | |
'booking' => $wnumber, | |
'completed' => 1, | |
) | |
); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to change line 9:
if (is_array($booking_status) && ($booking_status[0]['completed'] ?? '' == 1)) {
return true;
}