Ver Mensaje Individual
  #19 (permalink)  
Antiguo 06/08/2011, 15:31
Avatar de andresdzphp
andresdzphp
Colaborador
 
Fecha de Ingreso: julio-2011
Ubicación: $this->Colombia;
Mensajes: 2.749
Antigüedad: 12 años, 9 meses
Puntos: 793
Respuesta: falla en leer los mp

Deberías hacer algo como esto:

Código PHP:
Ver original
  1. <?php
  2.  
  3.  
  4. # Incluimos la configuracion
  5. include('config.php');
  6. //Esto me supongo que viene del config.php
  7. $c = mysql_connect('localhost', 'root', '12345');
  8. mysql_select_db('basededatos');
  9.  
  10. $sql = "SELECT * FROM mensaje WHERE para='" . $_SESSION['s_username'] . "'";
  11. $res = mysql_query($sql) or die(mysql_error());
  12. ?>
  13.  
  14. Menu: <a href="listar.php">Ver mensajes</a> | <a href="crear.php">Crear mensajes</a> | <a href="cerrar.php">Cerrar sesion</a><br /><br />
  15. <table width="800" border="0" align="center" cellpadding="1" cellspacing="1">
  16.     <tr>
  17.         <td width="53" align="center" valign="top"><strong>ID</strong></td>
  18.         <td width="426" align="center" valign="top"><strong>Asunto</strong></td>
  19.         <td width="321" align="center" valign="top"><strong>De</strong></td>
  20.         <td width="321" align="center" valign="top"><strong>Fecha</strong></td>
  21.     </tr>
  22.     <?php
  23.     while ($show = mysql_fetch_assoc($res)) {
  24.         ?>
  25.         <tr bgcolor="<?php if ($show['leido'] == "si") {
  26.         echo "#FFE8E8";
  27.     } else {
  28.         if ($i % 2 == 0) {
  29.             echo "#FFE7CE";
  30.         } else {
  31.             echo "#FFCAB0";
  32.         }
  33.     } ?>">
  34.             <td align="center" valign="top"><?php echo $show['ID'] ?></td>
  35.             <td align="center" valign="top"><a href="leer.php?id=<?php echo $show['ID'] ?>"><?php echo $show['asunto'] ?></a></td>
  36.             <td align="center" valign="top"><?php echo $show['de'] ?></td>
  37.             <td align="center" valign="top"><?php echo $show['fecha'] ?></td>
  38.         </tr>
  39.     <?php
  40. }
  41. ?>
  42. </table>
__________________
Si sabemos como leer e interpretar el manual será mucho más fácil aprender PHP. En lugar de confiar en ejemplos o copiar y pegar - PHP