Orden por fecha

Hola:
Tengo este codigo para mostrar los registros de una base de datos:
<?
include("intranet/abrir_bd.php");
////////////////////////////////
// id_tipo = 2 -- congresos
////////////////////////////////
$id_tipo=2;
$sql="SELECT id_noticia, titulo, titular, fecha FROM noticias WHERE id_tipo=$id_tipo ORDER BY fecha";
$result=mysql_query($sql,$Conn);
$str="<table width='400' border='0' bgcolor=\"#FFFFFF\" class=\"titulostabla\">";
if(list($id_noticia,$titulo,$titular,$fecha)=mysql_fetch_row($result)){
$str.="<tr bgcolor=\"#CCCCCC\"><td width='300'><div align='center'>Tipo de congreso</td>";
$str.="<td width='100'><div align='center'>Ampliar</tr>";
do{
$enlace = "<a href='#' onClick=\"MM_openBrWindow('ampliar.php?id=$id_noticia','ampliar','scrollbars=yes,width=515,height=300')\"><img src='img/ampliar.jpg' width='18' height='22'></a>";
$str.="<tr class=\"marcos\"><td class=\"marcos\">$titulo</td><td><div align=\"center\">$enlace</div></td></tr>";
}while(list($id_noticia,$titulo,$titular,$fecha)=mysql_fetch_row($result));
}
else{
$str.= "<tr><td>No hay actualmente.</td></tr>";
}
$str.= "</table>";
mysql_close($Conn);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script language="JavaScript">
// end absolutely positioned scrollable area object scripts
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<META http-equiv="Page-Enter" CONTENT="RevealTrans(Duration=1,Transition=1)">
<title>Planeta Farma</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.textos {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #336699;
}
div.tabIframeWrapper { width: 100%;
}
iframe.tabContent { background-color: #c0c0c0; width: 100%;
}
.scrolles {
scrollbar-face-color:#ABBDE7;
scrollbar-highlight-color:#FFFFFF;
scrollbar-shadow-color:#000066;
scrollbar-arrow-color:#006699;
SCROLLBAR-TRACK-COLOR: #CCCCCC;
}
.titulostabla {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8px;
font-style: normal;
line-height: normal;
font-weight: bold;
font-variant: normal;
text-transform: none;
text-decoration: blink;
color: #003366;
?); }
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body leftmargin="0" topmargin="0">
<tr>
<tr>
<td width="408" valign="middle">
<table width="637" height="315" border="0" align="left" cellpadding="0" cellspacing="0" topmargin="0" LEFTMARGIN="0">
<tr>
<td height="244" class="textos"> <div align="left">   
  </div></td>
<td colspan="10" class="scrolles">
<p align="left"></p> <DIV STYLE="position:absolute; overflow-x:hidden; overflow-y:scroll; float:left; top:46px; left:36px; width:414px; height:194px ">
<? Echo($str); ?>
</DIV>
<div id="Layer1" style="position:absolute; width:200px; height:23px; z-index:1; left: 41px; top: 13px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #336699;">:::Congresos médicos: </div>
<p align="center"> 
</p></td>
<td height="244" colspan="8" class="textos"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="187" height="116" hspace="0" vspace="0">
<param name="movie" value="entrada.swf">
<param name="quality" value="high">
<embed src="entrada.swf" width="187" height="116" hspace="0" vspace="0" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object></td>
<td class="textos"> </td>
<td height="244" class="textos"> </td>
</tr>
<tr>
<td width="33" height="77"><img src="img/sup_sin_r1_c1.gif" width="33" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42" height="44"></td>
<td width="42"><img src="img/sup_sin_r1_c2.gif" width="42"...

1 Respuesta

Respuesta
1
¿Y cuál es la pregunta?
Si es como ordenar por fecha:
$sql="SELECT id_noticia, titulo, titular, fecha FROM noticias WHERE id_tipo=$id_tipo ORDER BY fecha DESC";
Para que te salgan los más recientes primero

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas