Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/09/2009, 12:16
Avatar de rompeguesos
rompeguesos
 
Fecha de Ingreso: marzo-2009
Mensajes: 692
Antigüedad: 15 años, 1 mes
Puntos: 8
Pregunta hacer que se ordenen en orden descendente desde el segundo mensaje?

hola amigos, tengo en mi foro para que se vayan ordenando los mensajes mas nuevos en el final pero lo que me gustaria hacer es que salga el mensaje principal del tema y desde hay hacer que los mas nuevos se vayan poniendo primeros pero nunca por encima del mensaje principal es decir siempre en la 2ª posicion.

mi codigo es este:

Código PHP:
<?php
session_start
();

require(
'configuracion.php');

$id $_GET["id"];
if(empty(
$id)){
header("Location: index.php");
}


require(
'funciones.php');
include(
"funcionicono/emoticonos.php");
require(
"../usuarios/usu/menusuario/mensprivada/nm.php");
include(
"../funciones/usuariosenlinea/usuariosenlinea.php");

$sql "SELECT id, email, titulo, mensaje, youtube_video, login, ";
$sql.= "DATE_FORMAT(fecha, '%d/%m/%Y %H:%i:%s') as enviado FROM foro ";
$sql.= "WHERE id='".mysql_real_escape_string($id)."' OR identificador='".mysql_real_escape_string($id)."' ORDER BY fecha ASC";
$rs mysql_query($sql$con); 



if(
mysql_num_rows($rs)>0)
{
    include(
'titulos_post.html');
    
$template implode(""file('post.php'));
    while(
$row mysql_fetch_assoc($rs))
    {
        
$color=($color==""?"#5b69a6":"");
        
$row["color"] = $color;
        
//manipulamos el mensaje
        
$row["mensaje"] = nl2br($row["mensaje"]);
        
$row["mensaje"] = parsearTags(emoticonos($row["mensaje"]));
        
mostrarTemplate($template$row);
    }
}
?>
post.php

Código PHP:
<?php
$idprimera 
$_GET["id"];

include(
"configuracion.php");

$result=mysql_query("SELECT DATE_FORMAT(fecha,'%d/%m/%Y') fecha, avatar FROM usu WHERE email='".mysql_real_escape_string($login)."'",$con);
$rowusu=mysql_fetch_array($result);
?>
<table width="983px" border="0" align="center" cellpadding="2" cellspacing="2">
  <tr bgcolor="<?=$color?>"> 
    <td width="25%" valign="top"> <b><a name="<?=$id?>"><?php if($_SESSION["login"]){ echo "<a href=\"usu/miperfil.php?id=$id\">"; } ?><?=$email?><?php if($_SESSION["login"]){ echo "</a>"; } ?></a>
      </b><br>
      <font size="-2"><?php if(!$rowusu['fecha']==NULL){
      echo 
"Usuario desde: ".$rowusu['fecha']."<br />"; }?>
      Mensaje enviado el : <?=$enviado?><br />Avatar:<br /></font>
      <?php
      
echo "<div align=\"left\"><br /><img src=\"foro/usu/avatar/".$rowusu['avatar']."\" /></div>"?>
    </td>
    <td> 
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><strong><font size="-1"><?=$titulo?></font></strong> </td>
          <?php
          
if(isset($_SESSION['login'])){
          echo 
"<td align=\"right\" width=\"10%\"><a href=\"respuesta.php?id=$idprimera\"><img src=\"imagenes/responder.gif\" border=\"0\" /></a></td>";
          
          if (
$login==$_SESSION['login']){
          
?>
<form action="<? echo "editpost/actualizar.php" ?>" enctype="multipart/form-data" method="post" name="form">
<td width="13%" align="right">
<input name="id" type="hidden" value="<?php echo $id;?>">
<input name="submit" type="image" src="imagenes/botoneditar.gif">
</td>
</form>
<?php
}
          }
          
?>          
        </tr>
      </table>
      <hr align="center" width="100%" size="2" noshade>
      <?=$mensaje?>
      <br />
      <?php
      
if(!$youtube_video==NULL){
      
?>
      <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/<?php echo $youtube_video ;?>&rel=1&color1=0x2b405b&    color2=0x6b8ab6&border=1"></param>  <param name="wmode" value="transparent"></param>  <embed src="http://www.youtube.com/v/<?php echo $youtube_video ;?>&rel=1&color1=0x2b405b&color2=0x6b8ab6&border=1"    type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
      <?php
      
}
      
?>
      </td> 
  </tr>
</table>
no se me ocurre como hacerlo me dan alguna idea?