Jump to content

Nicolasuky

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Nicolasuky

  1. Estou gerando uma tabela com informações do banco de dados em PDF, porem no banco tem uma coluna chamada cores, onde armazena 3 cores como segue no código, estou conseguindo gerar o PDF, mas na coluna das cores não estou conseguindo associar a variável $color na propriedade "background-color" da <td>, ou seja, preciso que as celular da coluna cores fiquem com as cores associada ao banco. Na pagina Html eu consegui fazer mas aqui estou com dificuldades, destaquei a linha que estou com problemas. Estou usando o DomPDF. Desde já, agradeço a ajuda. <?php include_once("conexao.php"); $html = '<table border=1'; $html .= '<thead>'; $html .= '<tr>'; $html .= '<th>CORES</th>'; $html .= '<th>BANCO</th>'; $html .= '<th>STATUS ATUAL</th>'; $html .= '<th>PENDÊNCIA</th>'; $html .= '<th>PRÓXIMAS ATIVIDADES</th>'; $html .= '<th>RESPONSÁVEL</th>'; $html .= '<th>PREVISÃO</th>'; $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; $result_transacoes = "SELECT * FROM tb_banco"; $resultado_trasacoes = mysqli_query($conn, $result_transacoes); while($row_transacoes = mysqli_fetch_assoc($resultado_trasacoes)){ $cor = $row_transacoes["cores"]; if ($cor == "#008000") { $color = "green"; }else if ($cor == "#ff0000") { $color = "red"; }else if ($cor == "#ffff00") { $color = "Yellow"; } $html .= '<tr><td style="width:60px; background-color="<?php echo $color;?>"'."</td>"; $html .= '<td>'.$row_transacoes['banco'] . "</td>"; $html .= '<td>'.$row_transacoes['status_atual'] . "</td>"; $html .= '<td>'.$row_transacoes['pendencia'] . "</td>"; $html .= '<td>'.$row_transacoes['atividade'] . "</td>"; $html .= '<td>'.$row_transacoes['responsavel'] . "</td>"; $html .= '<td>'.$row_transacoes['previsao'] . "</td></tr>"; } $html .= '</tbody>'; $html .= '</table'; ......
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.