I'm attempting to wrap an auto-generated link around a thumbnail displayed from a Mysql database. Can someone help me with the syntax?

echo "<a href= 'http://www.website/link.php?field=".urlencode(img src='".$showimage"' height='10px' width='50px' />) . "'>$showimage</a>";

Thanks!

Member Avatar for diafol

I can't make head nor tail of that. It looks mashed to me. Usually:

<a href="..." ><img src="..." /></a>

Where ... will be urls. SO the $showimage I don't get. Is it an url or full image tag code or what?
I'm assuming here that the content of the link is an image not text/filename.

I have dynamically created links that attach themselves to information pulled from the database.

echo "<a href= 'http://www.website.com/test/link.php?field=".urlencode($imgrow['data'] ) . "'><h3>$imgrow[data]</h3></a>";

The above works. I wanted to do the same for the following thumbnails:

echo "<img src='".$showimage."' height='203px' width='135px' />";

What is the code to create an auto-generated link around that image?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.