Puedo ayudarte con el fondo amarillo: while ($data = sqlsrv_fetch_array($result,SQLSRV_FETCH_ASSOC)) { if ($i == 0) { $counter = 0; foreach($data as $key => $value) { $tabla .="<th scope='col' style='text-align: center;background-color: #054AC4;color: #fff'>" . $key . "</th>"; $counter++; if ($counter % 3 == 0) { $tabla .= "<th style='background: black'> </th>"; } } $tabla .="</tr>"; $tabla .="</thead>"; $tabla .="<tbody>"; } foreach($data as $key => $value) { if($value=="ZONA I - ADONIAS SILVA" or $value=="ZONA II - DANNY CANELA" or $value=="ZONA III - SANDRO CHAVEZ") { $tabla .= "<tr style='background: yellow'>"; } elseif ($key == 'agencia') { $tabla .="<tr>"; } $tabla .="<td>".$value."</td>"; } $tabla .="</tr>"; $i++; }