require_once('../manager/includes/config.inc.php'); require_once('../manager/includes/document.parser.class.inc.php'); $modx = new DocumentParser; // ******** UPDATE SESSION 1 PLACES ********** if (isset($RSAchecked) && ($RSAchecked === 1)) { $update_seats1 = update_places1($id1, $seats); function update_places1($id1, $seats) { global $modx; $table = "`prefix_modx`.`xtra_session`"; $update_seats1 = '`places` -' .$seats; $result = $modx->db->update( '`places` = ' . $update_seats1, $table, '`id` = ' . intval($id1, 10) . ' AND `places` >= ' . $seats ); return $result; // Returns 'true' on success, 'false' on failure. } } // ******** UPDATE SESSION 2 PLACES ********** if (isset($RSGchecked) && ($RSGchecked === 1)) { $update_seats2 = update_places2($id2, $seats); function update_places2($id2, $seats) { global $modx; $table = "`prefix_modx`.`xtra_session`"; $update_seats2 = '`places` -' .$seats; $result = $modx->db->update( '`places` = ' . $update_seats2, $table, '`id` = ' . intval($id2, 10) . ' AND `places` >= ' . $seats ); return $result; // Returns 'true' on success, 'false' on failure. } }
require_once('../manager/includes/config.inc.php'); require_once('../manager/includes/document.parser.class.inc.php'); $modx = new DocumentParser; if (!function_exists('update_places1')) { function update_places1($id1, $seats) { global $modx; $table = "`prefix_modx`.`xtra_session`"; $update_seats1 = '`places` -' .$seats; $result = $modx->db->update( '`places` = ' . $update_seats1, $table, '`id` = ' . intval($id1, 10) . ' AND `places` >= ' . $seats ); return $result; // Returns 'true' on success, 'false' on failure. } } } if (!function_exists('update_places2')) { function update_places2($id2, $seats) { global $modx; $table = "`prefix_modx`.`xtra_session`"; $update_seats2 = '`places` -' .$seats; $result = $modx->db->update( '`places` = ' . $update_seats2, $table, '`id` = ' . intval($id2, 10) . ' AND `places` >= ' . $seats ); return $result; // Returns 'true' on success, 'false' on failure. } } } // ******** UPDATE SESSION 1 PLACES ********** if (isset($RSAchecked) && ($RSAchecked === 1)) { $update_seats1 = update_places1($id1, $seats); } // ******** UPDATE SESSION 2 PLACES ********** if (isset($RSGchecked) && ($RSGchecked === 1)) { $update_seats2 = update_places2($id2, $seats); }
if (!function_exists('update_places1'))
// ******** UPDATE SESSION 1 PLACES ********** if (isset($RSAchecked) && ($RSAchecked === 1)) { // update_places1($id1, $seats); print "RSAchecked variable is set and id1 equals ". $id1 " | seats equals ". $seats; } // ******** UPDATE SESSION 2 PLACES ********** if (isset($RSGchecked) && ($RSGchecked === 1)) { //update_places2($id2, $seats); print "RSGchecked variable is set and id2 equals ". $id2 " | seats equals ". $seats; }
// ******** UPDATE SESSION 1 PLACES ********** if (isset($RSAchecked) && ($RSAchecked === 1)) { update_places1($id1, $seats); } // ******** UPDATE SESSION 2 PLACES ********** if (isset($RSGchecked) && ($RSGchecked === 1)) { update_places2($id2, $seats); }