How to put td as link.

Asked

Viewed 588 times

0

Good morning, you guys!

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

That’s 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’d appreciate it. :)

2 answers

4


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

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

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

  • 1

    It worked perfectly. I’ll just wait for the time stipulated by Stackoverflow to score as the right answer. Thank you!

0

Do so:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.