Hey guys could i get some advice on displaying images using sql and php.
i have got a auction database set up and running just in text .
But would like to get the images to link to it the only issue is i have got a seperate database for items with images and my auction is displayed from a api so i only get the item text name .
That why i have the images in a seperate database but would love to able to link the name of my image to the name of text. i have been trying to work this out .i can get the images to display but it doesnt pick the name i am after .
Thanks in advance if you can help with this issue
Dave
Image display though sql
Re: Image display though sql
i would name the images the same as the item names.
so...
item: WoodenSword
image file name: WoodenSword.png
then create a new variable to hold the root and file name of you image...
$image = "../images/items/" . $itemName . ".png";
echo "<img src='$image' />
that should work just nicely.
so...
item: WoodenSword
image file name: WoodenSword.png
then create a new variable to hold the root and file name of you image...
$image = "../images/items/" . $itemName . ".png";
echo "<img src='$image' />
that should work just nicely.
New Site Coming Soon! Stay tuned 
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Image display though sql
That is definitely a better setup. Holding the images in the database will put a ton of unneeded strain on MySQL.
The indelible lord of tl;dr
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Image display though sql
i show this in Urban Realms videos. Like Torn said, all you store is the file name, then echo it out as a image.