
08/09/2004, 08:29
|
| | Fecha de Ingreso: mayo-2004
Mensajes: 75
Antigüedad: 20 años, 10 meses Puntos: 0 | |
noticias.php
<?
include ('config.inc.php');
$sql = "SELECT noticias.*, noticias_top.* FROM noticias, noticias_top WHERE noticias.topico=noticias_top.topico_id ORDER BY noticias.id DESC LIMIT 5";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)) {
echo "<br><br>
<table width=100% border=0 cellpadding=5 cellspacing=1 bgcolor=#999999>
<tr>
<td width=80%><span class=Estilo1>$row[titulo]</span></td>
<td width=20% bgcolor=c0c0c0><div align=right>$row[fecha]</div></td>
</tr>
<tr bgcolor=c0c0c0>
<td colspan=2><table width=100% border=0>
<tr>
<td width=5%><img border=\"1\" src=\"imagenes/$row[imagen]\" width=\"50\" height=\"50\"></td>
<td width=95%>$row[noticia]</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan=2>
<table width=100% border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=80%><b>Enviada por:</b> $row[usuario] comentarios:$total</td>
<td><a href=index.php?mod=noticiacompleta&id=$row[id]>Noticia Completa</a></td>
</tr>
</table></td>
</tr>
</table>";
}
?>
ese es el codigo normal de noticias.php ,entonces ahora tendria q ponerle este otro para q me funcionase el contador de comentarios:
$result = mysql_query("SELECT count(*) FROM n_comentarios WHERE id_noticia=$id");
$total = mysql_num_rows($result);
echo $total |