Ver Mensaje Individual
  #10 (permalink)  
Antiguo 12/07/2006, 12:12
luque_finde
 
Fecha de Ingreso: marzo-2004
Mensajes: 53
Antigüedad: 20 años, 1 mes
Puntos: 0
totalmente de acuerdo!!! Ahi va:

<?php
include("date.php");

# Conectamos
$db = mysql_connect("mysql4.bluegravity.com","unilmomp", "56ellc64ddje");
$base = mysql_select_db("movilundba", $db);
# Consultamos
$sql = "SELECT * FROM noticias WHERE fecha>='$hoy_ok' ORDER BY fecha DESC";
$result = mysql_query($sql) or die (mysql_error());

$sql2 = "SELECT fecha FROM noticias WHERE fecha>='$hoy_ok' ORDER BY fecha DESC";
$result2 = mysql_query($sql2) or die (mysql_error());

# Mostramos
while ($registro2 = mysql_fetch_array($result2)) {
$meses[]=substr("$registro2[fecha]",4,2);
}
$total=count($meses);

$contador=0;
while ($registro = mysql_fetch_array($result)) {

$ano=substr("$registro[fecha]",0,4);
$mes=substr("$registro[fecha]",4,2);
$dia=substr("$registro[fecha]",6,2);
$hora=substr("$registro[fecha]",8,2);
$minuts=substr("$registro[fecha]",-2);

$registro_fecha = $dia."/".$mes."/".$ano." - ".$hora.":".$minuts."h";
$registro_titulo = strtoupper($registro[titulo]);
$registro_noticia = nl2br($registro[noticia]);


switch ($meses[$contador]) {
case "01" : $mes_ok="ENERO";break;
case "02" : $mes_ok="FEBRERO";break;
case "03" : $mes_ok="MARZO";break;
case "04" : $mes_ok="ABRIL";break;
case "05" : $mes_ok="MAYO";break;
case "06" : $mes_ok="JUNIO";break;
case "07" : $mes_ok="JULIO";break;
case "08" : $mes_ok="AGOSTO";break;
case "09" : $mes_ok="SEPTIEMBRE";break;
case "10" : $mes_ok="OCTUBRE";break;
case "11" : $mes_ok="NOVIEMBRE";break;
case "12" : $mes_ok="DICIEMBRE";break;
};




if (($meses[$contador] != 0) && ($meses[$contador] != $meses[$contador-1]) && ($contador < $total)) echo "<strong>$mes_ok ".$ano."<br></strong>";



echo "<img src=images/icon_agenda.gif>$registro_fecha<br>";
echo "<strong>$registro_titulo</strong><br>";
echo "$registro_noticia<br><br>";

$contador++;
}
?>