hotmert Posted January 1, 2012 Share Posted January 1, 2012 images are uploaded to a directory and the sql database contains the filename. I added 'url' field and am trying to link the two I have used on of the posts to help me adapt some script however I'm not sure I have the syntax right. The image in DW live view looks ok and I get the link finger ok but when previewed in browser the image is not shown at all or any link. Any ideas <? echo !empty($row['pic']) ? "<a href=\"{$row['url']}\" <img src=\"js/images/{$row['pic']}\">" : ''; ?> it echos out to a table Mike Link to comment https://forums.phpfreaks.com/topic/254165-make-a-pic-from-a-directory-clickable-to-a-url-from-my-database/ Share on other sites More sharing options...
AyKay47 Posted January 1, 2012 Share Posted January 1, 2012 what exactly does $row['url'] contain? you should get into the habit of using full <?php ?> tags, as not all servers are enabled for short tags. what does a view source in the browser show? Link to comment https://forums.phpfreaks.com/topic/254165-make-a-pic-from-a-directory-clickable-to-a-url-from-my-database/#findComment-1303082 Share on other sites More sharing options...
hotmert Posted January 1, 2012 Author Share Posted January 1, 2012 Ok so on closer inspection I notice a > close tag missing. That sorted out the browser issue. As for {$row['url']} im hoping that will bee the target when someone clicks on the pic Link to comment https://forums.phpfreaks.com/topic/254165-make-a-pic-from-a-directory-clickable-to-a-url-from-my-database/#findComment-1303085 Share on other sites More sharing options...
hotmert Posted January 1, 2012 Author Share Posted January 1, 2012 Ok well it all works ok now Link to comment https://forums.phpfreaks.com/topic/254165-make-a-pic-from-a-directory-clickable-to-a-url-from-my-database/#findComment-1303087 Share on other sites More sharing options...
hotmert Posted January 1, 2012 Author Share Posted January 1, 2012 x Link to comment https://forums.phpfreaks.com/topic/254165-make-a-pic-from-a-directory-clickable-to-a-url-from-my-database/#findComment-1303088 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.