tml Posted October 2, 2008 Share Posted October 2, 2008 i have a code that works to get a picture from my db: echo "<img src='" . $row["sti"] . "' class='foto'/>"; my problem are to make it a link so it open the same picture but in larger view, i have tryid abit and this are what i could think of so fair echo "<a href='" . $row["stilarge"] . "'><img src='" . $row["sti"] . "' class='foto'/>"</a>; but i wont work, i have 3 table, 1 id one, one url like pic/1.jpg(sti) and the last for the large pic (stilarge) so all i need is the link where it select same id but the large picture. needs to open in same window not like target_new Link to comment https://forums.phpfreaks.com/topic/126800-solved-link-from-pic-and-db/ Share on other sites More sharing options...
genericnumber1 Posted October 2, 2008 Share Posted October 2, 2008 assuming you have the rows right echo "<a href='{$row["stilarge"]}'><img src='{$row["sti"]}' class='foto' /></a>"; should work... what do you mean when you said "but it wont work" what is it doing that you say it isn't working? Link to comment https://forums.phpfreaks.com/topic/126800-solved-link-from-pic-and-db/#findComment-655864 Share on other sites More sharing options...
F1Fan Posted October 2, 2008 Share Posted October 2, 2008 If you want it in place of the smaller image, you could try this: echo "<img onclick=\"this.src='$row["stilarge"]'\" src='" . $row["sti"] . "' class='foto'/>"; Link to comment https://forums.phpfreaks.com/topic/126800-solved-link-from-pic-and-db/#findComment-655867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.