hey guys
I'm having a little trouble building links to retrieve images using php variables. My server has a folder called "thumbnails" and in the folder I have sub-folders called "hockey" "basketball" "baseball" and "football", each of which hold little jpg images. I have a MySQL database that have fields called "section" and "thumbnail_path", which have a path to a specific image and the section of that image that correlate to that row of data.
Now the thumbnail image appears
when the thumbnail_path field in the db is in the form "thumbnails/hockey/rangers.jpg" and the php code is...
PHP Code:
<?php $thumbnail = $row['thumbnail_path']; echo "<img src='http://www.mysite.com/$thumbnails'></img>" ; ?>
But what I'm trying to do is set it up so that the
thumbnail_path field in the db is in the form
"rangers.jpg" and the php code is...
PHP Code:
<?php $section = $row['section']; $thumbnail = $row['thumbnail_path']; echo "<img src='http://www.mysite.com/thumbnails/$section/$thumbnail'></img>" ; ?>
I've can't seem to get method #2 to work. any suggestions?
Last edited by worldy; 07-04-2010 at 07:19 PM..
|