Jump to content

Hyperlink in one cell


Besugo

Recommended Posts

Hi!

 

I'm trying to make hyperlinks from single cells of a table generated from a query. I've managed to make the entire row a link, but i just want single cells from one row. The point is to have a list and then click the name of the file in a cell to download it.

 

This is what i'm doing:

 

<?php

  ?><table class="tabResultados">

  <tr style="text-align: center; font-weight: bold;"><td>Listagem de Propostas</td></tr>

  <tr class="trResultados"><?

  if(! $result) { ?><th>O resultado não é válido</th><? }

  else {

  ?><th>Nº</th>

      <th>Descrição</th>

      <th>Cliente</th>

      <th>Obra</th>

      <th>Ficheiros</th>

      <th>Tamanho</th>

      <th>Data</th>

    <?

    $i = 0;

    while ($i < mysql_num_fields($result)) {

    $meta = mysql_fetch_field($result, $i);

      $i++;

    }

    ?></tr><?

 

    if(mysql_num_rows($result) == 0) {

      ?><tr><td colspan="<?=mysql_num_fields($result)?>">

      <strong><center>Não foram encontrados resultados.</center></strong>

      </td></tr><?

    } else

 

      while($row=mysql_fetch_assoc($result)) {

        ?><tr><?

        foreach($row as $key=>$value) {

       

        ?><td><?=$value?></td><?

        }

        ?></tr><?

      }

  }

  ?></table><?

 

mysql_close($con);

?>

 

I thank you all in advance for any help u can give me.

 

Have a nice day  :)

Link to comment
https://forums.phpfreaks.com/topic/190405-hyperlink-in-one-cell/
Share on other sites

<?php

  ?><table class="tabResultados">

  <tr style="text-align: center; font-weight: bold;"><td>Listagem de Propostas</td></tr>

  <tr class="trResultados"><?

  if(! $result) { ?><th>O resultado não é válido</th><? }

  else {

  ?><th>Nº</th>

      <th>Descrição</th>

      <th>Cliente</th>

      <th>Obra</th>

      <th>Ficheiros</th>

      <th>Tamanho</th>

      <th>Data</th>

    <?

    $i = 0;

    while ($i < mysql_num_fields($result)) {

    $meta = mysql_fetch_field($result, $i);

      $i++;

    }

    ?></tr><?

 

    if(mysql_num_rows($result) == 0) {

      ?><tr><td colspan="<?=mysql_num_fields($result)?>">

      <strong><center>Não foram encontrados resultados.</center></strong>

      </td></tr><?

    } else

 

      while($row=mysql_fetch_assoc($result)) {

        ?><tr><?

        //foreach($row as $key=>$value) {

        ?><td><?=$row['nmrProposta']?></td><?

        ?><td><?=$row['descProposta']?></td><?

        ?><td><?=$row['clienteProposta']?></td><?

        ?><td><?=$row['obraProposta']?></td><?

        ?><td><a href="#"><?=$row['nomeFile']?></a></td><?

        ?><td><?=$row['sizeFile']?></td><?

        ?><td><?=$row['createdFile']?></td><?

       

        ?></tr><?

      }

  }

  ?></table><?

 

mysql_close($con);

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.