<?php require_once('Connections/cn.php'); ?>
<?php
	$id_materia=$_GET['id_materia'];
	$id_carrera=$_GET['id_carrera'];
	$id_mencion=$_GET['id_mencion'];
	$pensum=$_GET['pensum'];
	$nivel=$_GET['nivel'];
	mysql_select_db($database_cn, $cn);
	mysql_query ("SET NAMES 'utf8'");
 	$sql = "select * from materias where id_carrera='$id_carrera' and id_materia='$id_materia' and            id_mencion='$id_mencion' and pensum='$pensum' and nivel='$nivel'";
 	$rs=mysql_query($sql, $cn);
	$reg=mysql_num_rows($rs);
	if ($reg != 0)
	 {
	 ?>
	 <script type="text/javascript">
	    msj="Unidad Curricular "+'<?php echo $id_materia; ?>' +" ya existe"
	 	alert(msj);
		window.parent.document.addrec.id_materia.focus();
		window.parent.document.addrec.id_materia.value="";
	 </script>
	 <?php
	 }
?>