Sorry very very new to php , at the end of my table is the following

echo $row['ProductUrl'];
	echo "</td></tr>";
}

i want to have an image show on the page and on click of that image it then go to the product url.

The [ProductUrl] from data base is a full http:// url

Please can you help

Recommended Answers

All 9 Replies

Hi, I hope this will help you,

<a href="your product detail page"><img src="<?php echo $row?>"></a>

thanks for your reply but the code does not seem to work

Can you share your code, so I will be more helpful to you!

while($row = mysql_fetch_array( $result )) {
	echo "<tr><td>"; 
	echo $row[''];
	echo "<img src='".$row['ImageUrl']."'width='60' height='80'/>";
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>"; 
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row[''];
	echo "</td><td>";
	echo $row['ProductUrl'];
	echo "</td></tr>";

Hope that is better, yet again thanks for trying to help

I understand you need listout all the product images & after click on that image you need to go on product detail page.? right?

Here is code for only image listing..
<?php

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

?>

<tr><td><a href="<?php echo $row;?>"><img src='".$row."'width='60' height='80'/></a></td></tr>


<?php

}
?>

may be this will help for go ahead!

sorry i seem to have mislead you, all the rows will be full with fields from the database information but the bottom one is a product url i need to put a buy now image that i have in its place but with that a link from the database field .

So when the customer clicks on that image it takes them to the

Hope i have explained myself better

Do you have a master page for yout product buynow?
Im assuming your buynow image is the same for all products
such as www.example.com/buynow.php?product=producturl
in which case the correct code would be:

<td><a href="buynow.php?product=<?php echo $row['productUrl'];?>"><img src="images/buynow.jpg" width='60' height='80'/></a></td>

Alternatively if producturl is the entire url:

<td><a href="<?php echo $row['productUrl'];?>"><img src="images/buynow.jpg" width='60' height='80'/></a></td>

Is this correct?

no it just messes the whole table up, no master page.


Thanks for trying to help

ok well the code looks fine.
can you please post an example of productUrl?
like just one of the entries so i can see the html code within the url that might be stuffing it up.
for example if you have some " double quotes it will stuff up and you will need to replace with char references (here)

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.