<?php

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

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

	$sql->update_table('school', array('sc_deleted' => 1), array('sc_id' => $this->get_id()));

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


?>