Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/07/2010, 15:21
Toninito
 
Fecha de Ingreso: abril-2010
Mensajes: 40
Antigüedad: 14 años
Puntos: 0
Respuesta: Color de fila segun valor

claro aqui esta completo gracias

<?php

$hospedaje = 'xxxxxxxxxx';
$usuario = 'xxxxxxx';
$salvoconducto = 'xxxxxx';
$basededatos = 'xxxxxxxxx';

$conexion = new mysqli($hospedaje, $usuario, $salvoconducto, $basededatos);

if (mysqli_connect_errno()) {
echo mysqli_connect_errno();
echo ':';
echo mysqli_connect_error();
exit();
}

$sql = "select * from xx order by id asc";

$recurso = $conexion->query($sql);

?>


<?php
echo "<p>" . "Registros: " . $recurso->num_rows . "</p>";
echo "<table style='font-family: Calibri; font-size: x-small;' border=1><tbody><tr style=background-color:#F2F2F2>
<th>Id</th>
<th>Origen</th>
<th>Nombre</th>
<th>Apellido Paterno</th>
<th>Apellido Materno</th>
<th>Telefono</th>
<th>Correo</th>
<th>Estado</th>
<th>Interesado</th>
<th>Comentarios</th>
<th>Informacion</th>
<th>Fecha</th>
<th>Hora</th>
</tr>";

function verColor($hr){

switch($hr){

case 'Prodigy':{
echo 'style="background:#FF0000"';

break;
}

case 'Google':{
echo 'style="background:#0000FF"';
break;
}

case 'Facebook':{
echo 'style="background:#99FF00"';
break;
}



}// fin switch
}// fin funcion



while ($fila = $recurso->fetch_array()) {
?>
<tr <?php verColor($fila[13]); ?> >
<?php
for($i=0; $i<=13; $i++){
?>
<td><?php echo $fila[$i]; ?></td>
<?php
}// fin for
?>
</tr>
<?php
}// fin while
?>

</table>

<p><?php echo "Registros: ".$recurso->num_rows; ?> </p>