I have following tables for photo album script. How to display Album title and album cover inside anchor tag?
(Display Albums cover on homepage and redirect to gallery page, when clicked, to see images inside that album)
- get id of album
- get album title
get album cover of each album
while($row = mysql_fetch_assoc($result)) { <a href="gallery.php?id=$id"><img src=""><span><?php echo $title?></span></a> }
Database
CREATE TABLE IF NOT EXISTS `albums` (
`album_id` mediumint(12) NOT NULL AUTO_INCREMENT,
`album_name` varchar(255) NOT NULL,
PRIMARY KEY (`album_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
CREATE TABLE IF NOT EXISTS `album_cover` (
`cover_id` mediumint(12) NOT NULL AUTO_INCREMENT,
`album_id` mediumint(12) NOT NULL,
`photo_id` mediumint(12) NOT NULL,
PRIMARY KEY (`cover_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
CREATE TABLE IF NOT EXISTS `images` (
`photo_id` mediumint(12) NOT NULL AUTO_INCREMENT,
`photo_title` varchar(255) NOT NULL,
`thumbnail` varchar(255) NOT NULL,
`album_id` mediumint(12) NOT NULL,
PRIMARY KEY (`photo_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7 ;