Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/09/2008, 04:26
serg1
 
Fecha de Ingreso: junio-2008
Mensajes: 8
Antigüedad: 15 años, 10 meses
Puntos: 0
Ultimos post phpbb3

Buenas foreros.
Tengo un codigo que me muestra los X ultimos mensajes de un foro phpbb3 y la categoria en la que esta.

Funciona correctamente pero hay una cosa que quiero cambiar y que no se como.
Al mostrarse, repite el titulo de un tema tantas veces como post tenga en el.
Me gustaria que solo mostrara una vez un tema y en orden del a fecha.
El codigo es este.
Código:
<table width="100%" background="index_files/04_secContent_bg.jpg" cellpadding="0" cellspacing="0">
<?
$directorio = "../phpBB3"; 
$mostrar = "10"; 
$caracteres = "18"; 
include("$directorio/config.php");
echo "";

$conexion = mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$conexion);
$consulta = "select * from ".$table_prefix."posts order by post_time desc";
$resultado = mysql_query($consulta);
$i = 0;
while ($rows = mysql_fetch_array($resultado)) {
if ($i <= $mostrar) {
$consulta1 = "select * from ".$table_prefix."forums where forum_id='$rows[forum_id]'";
$resultado1 = mysql_query($consulta1);
$datosf = mysql_fetch_array($resultado1);
#
$consulta3 = "select * from ".$table_prefix."topics where topic_id='$rows[topic_id]'";
$resultado3 = mysql_query($consulta3);
$datost = mysql_fetch_array($resultado3);

if (strlen($datost[topic_title]) > $caracteres) {
$datost[topic_title] = substr($datost[topic_title],0,20)."...";
}

echo "  <tr height=\"30\">
		<td align=\"center\" width=\"10\"><img src=\"index_files/page_white.gif\"></td>
		<td align=\"left\" width=\"168\"><font color=\"#666666\"><b><font color=\"#cb2c17\">$datosf[forum_name]</font></b></font><br><a href=\"$directorio/viewtopic.php?t=$rows[topic_id]\" style=\"padding-left:15px\">$datost[topic_title]</a></td>
		<td align=\"center\" width=\"20\"><b>$replys</b></td>
	</tr>";
$i++;
}
}

echo "";

mysql_free_result($resultado);
mysql_close($conexion);
?></table>