<?php

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

	//ahol ez a trt_id van beállítva, ott null-ra állítjuk
	$training_query = "SELECT tr_id FROM training WHERE tr_training_type_trt_id = " . $this->get_id();
	$training_assoc_array = $sql->assoc_array($training_query);
	foreach ($training_assoc_array as $tr_id) {
		$sql->update_table('training', array('tr_training_type_trt_id' => 'null'), array('tr_id' => $tr_id['tr_id']));
	}

	$sql->update_table('training_type', array('trt_deleted' => 1), array('trt_id' => $this->get_id()));


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


?>