<?php
////////////////////////////////////////////////////////////////////////
// Breeze Website Builder
// Copyright Silver Dolphin Solutions, LLC, Edward Lemmers, P.E.
// For licensing, see license.txt.
// Created: 1/19/2018	ELL

	include ("check_session.php");
	
	$id = $_REQUEST["id"];
	$category = $_REQUEST["category"];
	$category_string = $_REQUEST["category_string"];
	$sort_order = $_REQUEST["sort_order"];
	if (isset($_REQUEST["event_type"]) && ($_REQUEST["event_type"] == 1))
		$event_type = 1;
	else
		$event_type = 0;
	if (isset($_REQUEST["location_type"]) && ($_REQUEST["location_type"] == 1))
		$location_type = 1;
	else
		$location_type = 0;
	
	$query = "SELECT * FROM `" . BWB_TABLE_PREFIX . "event_location_categories` WHERE `id` = '$id'";
	$result = $bwb_dbh->query($query);
	if ($result->rowCount() > 0)
		$query = "UPDATE " . BWB_TABLE_PREFIX . "event_location_categories SET category = '$category', category_string = '$category_string', event_type = $event_type, location_type = $location_type, sort_order = '$sort_order' WHERE id = '$id'";
	else
		$query = "INSERT INTO " . BWB_TABLE_PREFIX . "event_location_categories SET category = '$category', category_string = '$category_string', event_type = $event_type, location_type = $location_type, sort_order = '$sort_order'";
	$cnt = $bwb_dbh->exec($query);
	
	echo 1;
?>