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