Hola, estoy haciendo un sistema de mensajes privados pero cuando le agrego el estilo tengo un problema, se desordena el css.
Tengo un if que se fija si hay mensajes.
Código PHP:
if ($row==$cero) {
echo("<center><b>No tienes mensajes.</b></center>");
} else {
echo' <table width="600" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="50" align="center" valign="top"><strong>Estado</strong></td>
<td width="50" align="center" valign="top"><strong>De</strong></td>
<td width="50" align="center" valign="top"><strong>Asunto</strong></td>
<td width="50" align="center" valign="top"><strong>Fecha</strong></td>
<td width="40" align="center" valign="top"><strong>Eliminar</strong></td>
</tr>
</tr>';
$i = 0;
while($row = mysql_fetch_assoc($res)){ ?>
<tr bgcolor="<?php if($row['leido'] == "si") { echo "#FFCAB0"; } else { if($i%2==0) { echo "FFA07A"; } else { echo "FFA07A"; } } ?>">
<td align="center" valign="top"><? if($row['leido'] == "si") { echo'<img src="leido.png" width="35" height="35" title= "Mensaje leído"; alt="Mensaje leído">'; } else { if($i%2==0) { echo'<img src="no-leido.png" width="35" height="35" title= "Mensaje NO leído"; alt="Mensaje NO leído">'; } else { echo'<img src="no-leido.png" width="35" height="35" alt="Mensaje NO leído">'; } } ?></td>
<td align="center" valign="top"><?=$row['de']?></td>
<td align="center" valign="top"><a href="leer.php?id=<?=$row['ID']?>"><?=$row['asunto']?></a></td>
<td align="center" valign="top"><?=$row['fecha']?></td>
<?php $i++;
} } ?>
ESTILO HTML
Cuando no hay mensajes muestra todo bien, cuando tens 1 o mas se mueve todo el estilo.