I need help to change the color of the rows of a table on the page only as long as the policy number and name are the same. The table already has a style but it is only necessary to change the color of the client and policy field if the item is repeated two or more times. I've tried putting conditional but it's not there yet. Thanks
<?php
require_once('class/Consultas.php');
$Reportes = new Reportes();
$dato = $_POST['dato'];
$array = $Reportes->getReportes($dato['telefono'], $dato['cliente'], $dato['promotoria'],$dato['FechaI'],$dato['FechaF']);
if(count($array)>0){
$tabla = '<div class="col-lg-12">
<img id="export" name="export" src="imagenes/logo_excel.png" style="cursor:pointer"/></td>
</div>
<div class="col-lg-12">
<div class="table-responsive" style="height:600px;">
<table class="table table-bordered table-condensed" id="Exportar_a_Excel">
<thead>
<tr bgcolor="gray" style="color:white;">
<th>#</th>
<th>ID</th>
<th>FECHA</th>
<th>PROMOTORIA</th>
<th>AGENTE</th>
<th>POLIZA</th>
<th>NOMBRE</th>
<th>PRIMA</th>
<th>TELEFONO1</th>
<th>TELEFONO2</th>
<th>ENCUESTADO</th>
<th>CODIFICACION</th>
<th>INTENTOS</th>
<th>COMENTARIOS</th>
<th>AGENDADO</th>
</tr>
</thead>
<tbody>';
$contador = 0;
$lista_colores=array('#F0F0F0','#99CC66','#FF5011');
$num_colores=2;
$indice=0;
foreach($array as $row){
$arrayCodf = $Reportes->getCodificacion($row['telefono1'], $row['telefono2'], $dato['codificacion'],$row["fecha"] );
if($arrayCodf[0]['ea'] == "")
$codif = "NO CODIFICADO";
else
$codif = $arrayCodf[0]['ea'];
if($arrayCodf[0]['intentos'] == "")
$intentos = "0";
else
$intentos = $arrayCodf[0]['intentos'];
if($row['encuestado'] == "")
$encuestado = "NO";
else
$encuestado = $row['encuestado'];
if($codif != "NO CODIFICADO" || $dato['codificacion'] == "0" || $dato['codificacion'] == "TODOS"){
$color=$lista_colores[$indice % $num_colores];
$indice = $indice + 1;
$tabla.= "<tr bgcolor='".$color."'>";
if($_SESSION['encuesta'])
$tabla.= '<td><a href="#" id="ShowEncuesta" data-id="'.$row['iddirectorio'].'" data-nombre="'.$row['nombre'].'">'.++$contador.'</a></td>';
else
$tabla.= '<td>'.++$contador.'</td>';
$tabla.= '<td><a href="#" id="ShowDirectorio" data-id="'.$row['iddirectorio'].'">'.$row['id'].'</a></td>';
$tabla.= '<td>'.$row['fecha'].'</td>';
$tabla.= '<td>'.$row['promotoria'].'</td>';
$tabla.= '<td>'.$row['agente'].'</td>';
$tabla.= '<td>'.$row['poliza'].'</td>';
$tabla.= '<td>'.$row['nombre'].'</td>';
$tabla.= '<td>'.$row['prima'].'</td>';
$tabla.= '<td>'.$row['telefono1'].'</td>';
$tabla.= '<td>'.$row['telefono2'].'</td>';
$tabla.= '<td>'.$encuestado.'</td>';
$tabla.= '<td>'.$codif.'</td>';
$tabla.= '<td>'.$intentos.'</td>';
$tabla.= '<td>'.$row['comentarios'].'</td>';
$tabla.= '<td>'.$row['agendado'].'</td>';
$tabla.= '</tr>';
}
}
/*
$dato['cliente'] = $dato['cliente'];
while ($damefila=mysql_fetch_object($array)){
echo "<tr ";
if ($dato['cliente']>=2)
echo "bgcolor=#354648"; //si el resto de la división es 0 pongo un color
else
echo "bgcolor=#ddddff"; //si el resto de la división NO es 0 pongo otro color
echo ">";
}
*/
$tabla.= '<tr bgcolor="gray" style="color:white;">
<td colspan="15" style="font-weight:bold;" align="center" >Total Reportes : '.$contador.'</td>
</tr>';
$tabla.= '</tbody>
</table>
</div>
</div>';
}else{
$tabla.= '<div class="col-lg-12">
<div class="alert alert-danger text-center">
SIN RESULTADOS PARA MOSTRAR
</div>
</div>';
}
echo $tabla;
?>