Ver Mensaje Individual
  #6 (permalink)  
Antiguo 24/07/2004, 12:55
Avatar de lado2mx
lado2mx
Colaborador
 
Fecha de Ingreso: agosto-2001
Ubicación: Veracruz
Mensajes: 3.720
Antigüedad: 22 años, 8 meses
Puntos: 9
a ver deja intento eso:
Código PHP:
<?
include("config.inc.php");
$id=$_GET["id"];
IF (
$id) {
$sql "SELECT * FROM noticias where ID='$id'";
$result mysql_query($sql);
$row mysql_fetch_array($result); 

// Se agregarán los <br> correspondientes a la noticia extendida
$noticiaext $row[noticiaext];
$noticiaext str_replace("\r\n","<br>",$noticiaext);

echo 
"<table width=100% border=0 cellpadding=5 cellspacing=1 bgcolor=#000000>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/borde.jpg>
<td width=80%><span class=Estilo7>$row[titulo]</span></td>
<td width=20%><div align=right>$row[fecha]</div></td>
</tr>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/bloque_noticias.jpg>
<td colspan=2>
$row[noticia]
<br><br>$noticiaext</td>
</tr>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/borde.jpg>
<td colspan=2>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=85%><b>Enviada por:</b> $row[usuario]</td>
</tr>
</table></td>
</tr>
</table>"
;
echo 
"<a href=../index.php>Volver</a>"
 } ELSE {
$mostrar ;
$sql "SELECT * FROM noticias ORDER BY id desc LIMIT $mostrar";
$result mysql_query($sql);
while(
$row mysql_fetch_array($result)) 
{
echo 
"<br><br>
<table width=100% border=0 cellpadding=5 cellspacing=1 bgcolor=#000000>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/borde.jpg>
<td width=80%><span class=Estilo7>$row[titulo]</span></td>
<td width=20%><div align=right>$row[fecha]</div></td>
</tr>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/bloque_noticias.jpg>
<td colspan=2>
$row[noticia]
</td>
</tr>
<tr bgcolor=#CCCCCC background=file:///C|/FoxServ/www/pchard/imagenes/borde.jpg>
<td colspan=2>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=85%><b>Enviada por:</b> $row[usuario]</td>
<td width=15%><a href=seccion/noticias.php>Leer más</a></td>
</tr>
</table></td>
</tr>
</table>"
;
}
?>
Cuando muestre la ID te dará la noticia, sinó, mostrará el resto de las notas que aparecen en tu tabla.

Otro detalle, le quité el while del id, porque no lo veo necesario, porque estás haciendo una consulta a una sola fila (id).

Última edición por lado2mx; 24/07/2004 a las 12:59