Click to See Complete Forum and Search --> : weird image link question


mjcocat
08-08-2003, 10:43 AM
I hope someone can help me out here.

I have an access database with thousands of records. One particular field is an eight digit number. This number also relates to where the records image is located. I need to devise a way to display the records image

example:

table field "product" = 12345678
image name = 12345678.jpg
location is ../678/12345678.jpg

the location is always in a subdirectory of the last three digits of the file number. How can I automate this in a script to display the image starting only with the original 8 numbers?

Thanks for your help.

pyro
08-08-2003, 10:48 AM
Something like this, maybe?

<?PHP
$product = "12345678";
$dir = substr($product, -3); #take the last three characters
echo "<img src=\"../$dir/$product.jpg\">";
?>