Reportes » DISTRIBUCIÓN DE LOS SECUESTRADOS POR TIPO DE desenlace
$sel_tipo_desenlace=mysql_query("SELECT tipo_desenlace
FROM `secuestrados`
GROUP BY tipo_desenlace");
$periodos=array();
while($row_tipo_desenlace=mysql_fetch_array($sel_tipo_desenlace)){
array_push($periodos,$row_tipo_desenlace["tipo_desenlace"]);
}
$total_auc=0;
$total_del=0;
$total_eln=0;
$total_farc=0;
$total_m19=0;
$total_total=0;
$resultado=array();
foreach($periodos as $value){
$datos=array();
$sel_auc=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor='Paramilitares' group by tipo_desenlace");
$sel_del=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor ='Redes Criminales' group by tipo_desenlace");
$sel_eln=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor='ELN' group by tipo_desenlace");
$sel_farc=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor='FARC' group by tipo_desenlace");
$sel_m19=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor='M-19' group by tipo_desenlace");
$sel_otros=mysql_query("SELECT COUNT( id ) AS num_sec,tipo_desenlace
FROM secuestrados
WHERE tipo_desenlace = '".$value."'
and autor='Otros' group by tipo_desenlace");
$row_auc=mysql_fetch_array($sel_auc);
$row_del=mysql_fetch_array($sel_del);
$row_eln=mysql_fetch_array($sel_eln);
$row_farc=mysql_fetch_array($sel_farc);
$row_m19=mysql_fetch_array($sel_m19);
$row_otros=mysql_fetch_array($sel_otros);
if($value <>""){
$sel_td=mysql_query("select * from desenlace where des_codigo='".$value."'");
$row_td=mysql_fetch_array($sel_td);
$datos["tipo_desenlace"]=utf8_encode($row_td["des_descripcion"]);
}else{
$datos["tipo_desenlace"]="Bajo estudio";
}
$datos["del"]=($row_del["num_sec"]==''?"0":$row_del["num_sec"]);
$datos["eln"]=($row_eln["num_sec"]==''?"0":$row_eln["num_sec"]);
$datos["farc"]=($row_farc["num_sec"]==''?"0":$row_farc["num_sec"]);
$datos["m19"]=($row_m19["num_sec"]==''?"0":$row_m19["num_sec"]);
$datos["auc"]=($row_auc["num_sec"]==''?"0":$row_auc["num_sec"]);
$datos["otros"]=($row_otros["num_sec"]==''?"0":$row_otros["num_sec"]);
//$datos["total"]=$row_auc["num_sec"]+$row_del["num_sec"]+$row_eln["num_sec"]+$row_farc["num_sec"]+$row_m19["num_sec"]+$row_otros["num_sec"];
$total=$row_auc["num_sec"]+$row_del["num_sec"]+$row_eln["num_sec"]+$row_farc["num_sec"]+$row_m19["num_sec"]+$row_otros["num_sec"];
$total_auc+=$row_auc["num_sec"];
$total_del+=$row_del["num_sec"];
$total_eln+=$row_eln["num_sec"];
$total_farc+=$row_farc["num_sec"];
$total_m19+=$row_m19["num_sec"];
$total_otros+=$row_otros["num_sec"];
$total_total+=$total;
array_push($resultado,$datos);
}
// print_r($resultado);
?>
DESENLACE
Redes Criminales
ELN
FARC
M-19
Paramilitares
Otros
foreach($resultado as $fechas=>$dateo){
?>
foreach($dateo as $key=>$valor){
if($key=='tipo_desenlace'){
?>