Lyric Site help

I have a lyric site and I am trying to display the correct album cover with the album a certain song is on. I am only doing this lyric site for one band. I am a noob to php so please help me out! I was thinking some sort of code that could do this…

If $album = AlbumName1, then display image http://www.website.com/album1image.jpg

Is this possible?

Thanks in advance!

Yes it is. What you can do is store the album’s name and the image name in a database, and output them like this:

echo "<b>".$albumName."</b><br>"; echo "<img src='".$imageName."'>";

You don’t have to work with if statements that way.

Thanks for the reply! I really don’t want to create another database because I already have one, and like I said before im a noob and I don’t want to mess anything up. But I will certainly do it if It is the only option. In my database, $album will display the album name of a lyric. With the code you gave me would I be able to match it up with a certain image like AlbumName1 gets AlbumImage1.jpg and AlbumName2 gets AlbumImage2.jpg… and so on. I am making this site for one band so I will only need to list like 10 albums.

If you already have a database table containing the name of the album, you should be able to alter the table to add a column called ‘image’ or something, in which you’ll store the image names.

Thanks! That worked great. I should of thought of that

Sponsor our Newsletter | Privacy Policy | Terms of Service