Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/10/2009, 16:41
nanosystems
 
Fecha de Ingreso: octubre-2009
Mensajes: 1
Antigüedad: 14 años, 6 meses
Puntos: 0
Color de la letra dentro de un while

Buen dia.

Tengo la siguiente tabla dentro de un archivo php.

<h1><div align="center">Registro Insertado</div></h1>

<table align="center" border="1">
<tr>
<th>Fecha Reclamo</th>
<th>Fecha recepcion</th>
<th>Taller</th>
<th>RMA</th>
<th>Pais</th>
<th>Comentarios</th>
<th>Emer</th>

while ($row=mysql_fetch_array($busq))
{
echo '<tr><td>'.$row["frecl"].'</td>';
echo '<td>'.$row["frecep"].'</td>';
echo '<td>'.$row["taller"].'</td>';
echo '<td>'.$row["rma"].'</td>';
echo '<td>'.$row["pais"].'</td>';
echo '<td>'.$row["comentarios"].'</td>';
echo '<td>'.$row["emer"].'</td></tr>';
}
mysql_free_result($busq)

Esta tabla me hace ver los datos que estan dentro de la tabla seleccionada, el sistema funciona bien.

Lo que yo quiero es que el color de letras del campo comentario cuando sale en la table sea rojo cuando el campo emer es igual a 2 de lo contrario dejarlo con el color de la fuente normal.

Pense en poner un if dentro del while tal como lo pongo a continuacion:
<h1><div align="center">Registro Insertado</div></h1>

<table align="center" border="1">
<tr>
<th>Fecha Reclamo</th>
<th>Fecha recepcion</th>
<th>Taller</th>
<th>RMA</th>
<th>Pais</th>
<th>Comentarios</th>
<th>Emer</th>



<?php
//Mostramos los registros
$red="#FF0000";
while ($row=mysql_fetch_array($busq))
{
echo '<tr><td>'.$row["frecl"].'</td>';
echo '<td>'.$row["frecep"].'</td>';
echo '<td>'.$row["taller"].'</td>';
echo '<td>'.$row["rma"].'</td>';
echo '<td>'.$row["pais"].'</td>';
If $row["emer"]=2
{
echo '<td>'<font color='"$red"'>.$row["comentarios"].'</td>';
}
else
{
echo '<td>'.$row["comentarios"].'</td>';
}

echo '<td>'.$row["emer"].'</td></tr>';

}
mysql_free_result($busq)
?>

pero me sale el siguente error: Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in C:\xampp\htdocs\acer\nuevoregistro.php on line 58


como podria lograr la funcionalidad que quiero??