Skip to content

Instantly share code, notes, and snippets.

@Chillifish
Last active June 12, 2018 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chillifish/8ddfcc2867aca596c4b60f7b35798e4c to your computer and use it in GitHub Desktop.
Save Chillifish/8ddfcc2867aca596c4b60f7b35798e4c to your computer and use it in GitHub Desktop.
Script check method
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;
}
}
@Chillifish
Copy link
Author

Need to change line 9:
if (is_array($booking_status) && ($booking_status[0]['completed'] ?? '' == 1)) {
return true;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment