<?php require_once('Connections/cn.php'); ?>

<?php



// header("Content-Type:text/html; charset=UTF-8");

header("Content-Type:text/html; charset=utf-8");

$Area= $_REQUEST["id"];

$c=$_REQUEST["c"];

$t=$_REQUEST["t"];



// Realizo la consulta de la Tabla materias filtrando con la carrera que se seleccion�.

 

mysql_select_db($database_cn, $cn);

mysql_query ("SET NAMES 'utf8'");



if($t=='4'){

$query_carreras = "Select

id_seccion

From

oferta_academica

Where

id_materia = '$Area' and

id_carrera = '$c' and turno='$t' and id_periodo='127' order by id_seccion";

}

else{

$query_carreras = "Select

id_seccion

From

oferta_academica

Where

id_materia = '$Area' and

id_carrera = '$c' and (turno='1' or turno='2') and id_periodo='127'  order by id_seccion";



}

$rst_carreras = mysql_query($query_carreras, $cn) or die(mysql_error());

//$row_materias = mysql_fetch_assoc($rst_materias);

$totalRows_carreras = mysql_num_rows($rst_carreras);  



if($totalRows_carreras >0)

{

	$array_carreras = array(0=>"Seleccione...");

	$array_cod = array(0=>"0");

	$code=1;

	while($carrera = mysql_fetch_assoc($rst_carreras))

		{

		

			$array_cod[$code] = $carrera["id_seccion"];		

			$array_carreras[$code]=  $carrera["id_seccion"];	

			$code += 1;

		}

}		



// Bucle para cargar las maetrias en el combo (materias)

for ($i=0; $i<count($array_carreras);$i++){

	echo "<option value=".$array_cod[$i].">".$array_carreras[$i]."</option>";

}



?>