require("/var/www/html/sistema/config.inc.php");
$db_conexion= mysql_connect($sql_host, $sql_usuario, $sql_pass) or die("No se pudo conectar a la Base de datos") or die(mysql_error());
mysql_select_db($sql_db) or die(mysql_error());
$db=$sql_db;
//die("conexion exitosasa");
//realizamos la busqueda en la base de datos
$pegar = "SELECT * FROM noticia where campus='1' ORDER BY date DESC";
$cad = mysql_db_query($db,$pegar) or die (mysql_error());
$meses = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
//imprimiendo los resultados
$año = "";
$mes ="";
echo ("
");
while($array = mysql_fetch_array($cad)) {
$href="href='#'";
$title="";
//if ($array[document]!= ""){
$href="target='_self' href='http://sistemas.upb.edu/sistema/preview.php?id=$array[code]'";
//}
if ($array[imagen_icono]!=""){
$href= "target='_self' href='".$array[imagen_icono]."'";
$title="Click para Ir a la Imagen...";
}
if ($array[url]!=""){
$href= "target='_self' href='".$array[url]."'";
$title="Click para Ir al enlace externo...";
}
$tres=substr($array[date], 0, 4);
$dos=substr($array[date], 5, 2);
$uno=substr($array[date], 8, 2);
$fecha = ($uno."/".$dos."/".$tres);
if ($año != $tres) {
$año = $tres;
if ($año != ""){
echo ("");
}
echo ("");
echo ("");
}
if (($mes != $dos) and ($año==$tres)){
$mes = $dos;
$num = $mes-1;
$string_mes= $meses[$num];
echo ("
| ".$string_mes." |
");
}
echo ("| ".$fecha." | ");
echo (" | ");
echo ("".$array[title]." | ");
echo ("".$array[description]." |
");
}
echo("
");
?>