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 Quote 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? Quote 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 Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.