How to put td as a link.

0

Good morning everyone!

I would like to put the contents of a <td> as a link so that the user can access the image that is in a folder on the server.

This is the:

//Montando o corpo da tabela
  $table .= '<tbody >';
  while($r = mysqli_fetch_array($qry)){
    $table .= '<tr>';
    $table .= '<td>'.$r['ID'].'</td>';
       $table .= '<td>'.$r['OQUE'].'</td>';
       $table .= '<td>'.$r['NOME'].'</td>';
       $table .= '<td>'.$r['IDENTIFIANT'].'</td>';
       $table .= '<td>'.$r['PREDIO'].'</td>';
       $table .= '<td>'.$r['POSTO'].'</td>';
       $table .= '<td>'.$r['INICIO'].'</td>';
       $table .= '<td>'.$r['DATA'].'</td>';
       $table .= '<td>'.$r['MES'].'</td>';
       $table .= '<td>'.$r['HORA'].'</td>';
       $table .= '<td>'.$r['ANO'].'</td>';
       $table .= '<td>'.$r['LOCALLESAO'].'</td>';
       $table .= '<td>'.$r['TIPOLESAO'].'</td>';
       $table .= '<td>'.$r['LADOLESAO'].'</td>';
       $table .= '<td>'.$r['FONTELESAO'].'</td>';
       $table .= '<td>'.$r['ACIDENTE'].'</td>';
       $table .= '<td>'.$r['ATENDIMENTO'].'</td>';
       $table .= '<td>'.$r['HOSPITAL'].'</td>';
       $table .= '<td>'.$r['CONCEQUENCIA'].'</td>';
       $table .= '<td>'.$r['FALHA'].'</td>';
       $table .= '<td>'.$r['DESCRICAO'].'</td>';
       $table .= '<td>'.$r['IMAGEM'].'</td>'; //É SÓ ESSA AQUI

      $table .= '</form></td>';

If you can help me, I thank you. :)

    
asked by anonymous 20.08.2018 / 14:22

2 answers

4

Since IMAGEM is a link to the image, you can do it as follows:

$table .= '<td><a href='.$r['IMAGEM'].'>'.$r['IMAGEM'].'</a></td>';

Otherwise it would be necessary to replace the content of href with the link you would like the user to be directed to.

    
20.08.2018 / 14:27
0

Do this:

$table .= '<td><a href="caminho-da-imagem-na-pasta">'.$r['IMAGEM'].'</a></td>'; //É SÓ ESSA AQUI
    
20.08.2018 / 14:26