Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/10/2010, 08:46
JMR08
 
Fecha de Ingreso: marzo-2009
Mensajes: 13
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: Imprimir datos y agrupar por relacion

Gracias Nano,
este es mi codigo
Código PHP:
Ver original
  1. <?
  2.  
  3. $con = mysql_connect("localhost","root","usbw");
  4. if (!$con)
  5.   {
  6.   die('Could not connect: ' . mysql_error());
  7.   }
  8.  
  9. mysql_select_db("post", $con);
  10. $query = "SELECT DISTINCT postmadre.titulo, respuestas.mensaje
  11. FROM postmadre LEFT JOIN respuestas
  12.     ON postmadre.id = respuestas.identificador";
  13.      
  14. $result = mysql_query($query) or die(mysql_error());
  15.  
  16.  
  17. // Print out the contents of each row into a table
  18. while($row = mysql_fetch_array($result)){
  19.  
  20.     echo  $row['titulo'];
  21.    
  22.     echo"<b> <div>";
  23.     echo $row['mensaje'];
  24.     echo"</b></div>";
  25.     echo "<br />";
  26. }
  27. ?>
esto es lo que me sale



y asi es como quiero que termine



muchas gracias :)