<?php

if ($this->is_id()) {
	//$delete_query = "DELETE FROM region WHERE reg_id = " . $this->get_id() . ";";
	//$sql->execute_query($delete_query);

	//akiknek ez a school_id van beállítva, azoknál null-ra állítjuk
	$region_query = "SELECT uk_id FROM user_kid WHERE uk_region_reg_id = " . $this->get_id();
	$region_assoc_array = $sql->assoc_array($region_query);
	foreach ($region_assoc_array as $uk_id) {
		$sql->update_table('user_kid', array('uk_region_reg_id' => 'null'), array('uk_id' => $uk_id['uk_id']));
	}

	$sql->update_table('region', array('reg_deleted' => 1), array('reg_id' => $this->get_id()));

	log::register('delete_region', $this->get_id());
	header("Location: /admin/regions");
}


?>