Jump to content
Sign in to follow this  

Linkar Imagem numa tabela

Recommended Posts


Boas , tenho um script que faz a leitura de uma tabela da bd , um desses campos é uma imagem ,e  queria que ao clicar na imagem fosse redireccionado pa outra pagina, ja tentei pelo href mas sem sucesso .Se pudessemm ajudar agradecia

vamos ao codigo

<table align="center" border=1>
<th>Marca </th>
<th>Numero de Kilómetros </th>
<th>Cor </th>
<th>Preço(€) </th>
$querybd=("SELECT marcas.desc_marca, modelos.desc_modelo, cor, marca, modelo,versao, n_kilometros, link_imagem, ano, preco ,potencia,combustivel
FROM viaturas, marcas, modelos
WHERE viaturas.marca =$cod_marca
AND viaturas.modelo =$cod_modelo
AND viaturas.marca = marcas.cod_marca
AND viaturas.marca = modelos.cod_marca
AND viaturas.modelo = modelos.cod_modelo
") ;

if ($result = mysql_query($querybd)) {

    echo '<td>'.$row["desc_marca"].'</td>';
        echo '<td>'.$row["desc_modelo"].'</td>';
        echo '<td>'.$row["versao"].'</td>';
        echo '<td>'.$row['potencia'].'</td>';
        echo '<td>'.$row["combustivel"].'</td>';
        echo '<td>'.$row['n_kilometros'].'</td>';
        echo '<td>'.$row["cor"].'</td>';
        echo '<td>'.$row['ano'].'</td>';
    echo '<td>'.$row['preco'].'</td>'; 
        echo "<td><img src='$row[7]' width=223 height=100><a href=testdrives.php></td></tr>";


        echo $cod_marca;
        echo $cod_modelo;

Share this post

Link to post
Share on other sites
<a href="destino.php"><img src="fonte.png" /></a>

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. 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.