Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/12/2009, 13:00
ingross
 
Fecha de Ingreso: octubre-2009
Mensajes: 34
Antigüedad: 14 años, 6 meses
Puntos: 1
Intercalar color en tablas

Hola que tal tengo una duda de como intercalar el color cuando hago mi consulta en mi tabla mi codigo es el sig

Código PHP:
<?php 
             
require 'conexion.php';
            
$link=conecta();
            
            
            
$db_seleccionada =bd();
            
$sql="select numero,clave,clave_con,conceptos,unidades,cantidad,costo_unitario, importe, c_sem1, i_sem1,c_est1,i_est1 ,a_sem from obracivil " 
            
$datos=mysql_query($sql,$link) or die ("Error en sintaxis de sql");
            
            echo 
"<table border='0' bordercolor = '#FFFFFF'>\n";
echo 
"<TH bgcolor='#3399FF'>Consecutivo</TH><TH bgcolor='#3399FF'>Código concepto</TH><TH bgcolor='#3399FF'>Concepto</TH><TH bgcolor='#3399FF'>Unidad</TH><TH bgcolor='#3399FF'>Presupuesto origen cantidad</TH><TH bgcolor='#3399FF'>Costo unitario</TH><TH bgcolor='#3399FF'>Presupuesto origen importe</TH><TH bgcolor='#9999FF'>Esta estimación cantidad</TH><TH bgcolor='#9999FF'>Esta estimación importe</TH><TH bgcolor='#009933'>Acumulado estimado cantidad</TH><TH bgcolor='#009933'>Acumulado estimado importe</TH><TH bgcolor='#FF0000'>Por estimar cantidad</TH><TH bgcolor='#FF0000'>Por estimar importe</TH>";
 

            
            while(
$reg=mysql_fetch_array($datos))
            {
            

?? 
color linea
                 
                
    
echo "<tr>";
$costo_unitario=number_format($reg['costo_unitario'],2);
$importe=number_format($reg['importe'],2);
$c_sem1=number_format($reg['c_sem1'],2);
$i_sem1=number_format($reg['i_sem1'],2);

$c_est1=number_format($reg['c_est1'],2);
$i_est1=number_format($reg['i_est1'],2);
//echo "<td width=60 align=right >&nbsp;".$reg["a_sem"]."</td>";                
echo "<td width=60 align=right >&nbsp;".$reg["numero"]."</td>";
echo 
"<td width=10 align=left >&nbsp;".$reg["clave_con"]."</td>";
echo 
"<td width=550 align=left >&nbsp;".$reg["conceptos"]."</td>";
echo 
"<td width=60 align=CENTER >&nbsp;".$reg["unidades"]."</td>";
echo 
"<td width=80 align=right >&nbsp;".$reg["cantidad"]."</td>";
echo 
"<td width=80 align=right >\$$costo_unitario</td>";
echo 
"<td width=80 align=right >\$$importe</td>";
//captura de datos reales

echo "<td width=80 align=right >\$$c_sem1</td>";
echo 
"<td width=80 align=right >\$$i_sem1</td>";

// acumulado estimado sem0 +sem1
echo "<td width=80 align=right >\$$c_sem1</td>";
echo 
"<td width=80 align=right >\$$i_sem1</td>";
// acumulado estimado c_sem-cantidad origen

echo "<td width=80 align=right >\$$c_est1</td>";
echo 
"<td width=80 align=right >\$$i_est1</td>";

//imagenes para editar o eliminar
//$a_sem="1";



//imagenes para editar o eliminar
echo "<td align=right><a href=borrar.php?numero=".$reg[0].".&a_sem=".$reg["a_sem"]."><img src=images/borrar.jpg title=eliminar_concepto /></a></td>";

echo 
"<td><a href=modificar.php?numero=".$reg["numero"].".&cantidad=".$reg["cantidad"].".&costo_unitario=".$reg["costo_unitario"].".&c_sem1=".$reg["c_sem1"].".&i_sem1=".$reg["i_sem1"].".&i_est1=".$reg["i_est1"].".&importe=".$reg["importe"].".&a_sem=".$reg["a_sem"]."><img src=images/edit.jpg title=modificar_cantidad /></a></td>";
//echo "<td><a href=actualizar_estado1.php?numero=".$numero.">".No."</a></td>";
                    
echo "</tr>";
            }
            echo 
"</table>";
            
mysql_free_result($datos);
            
mysql_close($link);

 
?>
He visto otos post que va abajo del while pero no me sale podrian ayudarme