Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/12/2009, 13:53
Avatar de jackson666
jackson666
 
Fecha de Ingreso: noviembre-2009
Ubicación: Buenos Aires, Argentina
Mensajes: 1.971
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Intercalar color en tablas

En realidad, hiciste exactamente eso, agarraste el codigo que te dije y lo pusiste como estaba. Y no era eso lo que habia que hacer....

Ademas no prestaste atencion a los comentarios que puse en el codigo, pusiste un == donde va un %
Ytambien sacaste el $i++ al final!

Código PHP:
$i=0
$color;
 
while(
$reg=mysql_fetch_array($datos)){
 
      
           if(
$i o/o 2 == 0){        
          
$color="#cccccc";       
 
         }else{
 
            
$color="#ffffff";
         }              
                
    echo 
"<tr bgcolor='$color'>";
$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>";

#nunca cerrabas tr
echo "</tr>";

$i++;

ACLARO: el simbolo o/o reemplazalo por % (es un problema del resaltador de codigo del foro creo)

NOTA: gracias por el karma!