954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

image and go to link from database

Please can somebody help with this. I want a Buy Now image to go to the producturl in the database, at the moment I am just echoing , so it only shows the text of the url in the cell.

my code currently is

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


Hope somebody can help as it is driving me mad..... newbies hey!!!!!

mpc123
Junior Poster in Training
50 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

Assuming your image is located at http://www.yoursite.com/Images/buyNow.gif , then try:

echo sprintf( '<a href="%s"><img src="%s"/></a>', $row['ProductUrl'], '/Images/buyNow.gif' );
	echo "</td></tr>";
hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
 

thanks alot that seems to have sorted it. Thanks again

mpc123
Junior Poster in Training
50 posts since Aug 2010
Reputation Points: 10
Solved Threads: 0
 

You are welcome! Be sure to mark the question as solved.

Regards,
Hielo

hielo
Veteran Poster
1,124 posts since Dec 2007
Reputation Points: 116
Solved Threads: 244
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: