Hello. I am trying to fix this for about 10 hours and i can't do it. I got a template from web and trying to make it dynamic. Somehow, i did something till now.. It get images from a database. Each picture is kind of a gallery and is somewhat a link to the pictures that has to be show at that gallery. The problem is, when i get the gallery from mysql, it will show them all, but only the last one will work. I put my code here and a link to see what i am talking about. Ty in advance.
SQL Code of my tables.
CREATE TABLE IF NOT EXISTS `album` (
`id_album` int(11) NOT NULL AUTO_INCREMENT,
`nume_album` varchar(128) NOT NULL,
`descriere_album` text NOT NULL,
`poza_album` varchar(128) NOT NULL,
PRIMARY KEY (`id_album`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
--
-- Dumping data for table `album`
--
INSERT INTO `album` (`id_album`, `nume_album`, `descriere_album`, `poza_album`) VALUES
(1, 'Test Bufnita 1', 'sdfsdfsfdsf', 'm-10.jpg'),
(11, 'Test bufnita 2', 'dfsfsdfsdfsdfsdfsdfsdf', 'm-10.jpg'),
(12, 'Test bufnita 3', 'dfsdfsfsdf', 'm-10.jpg');
-- --------------------------------------------------------
--
-- Table structure for table `imagini`
--
CREATE TABLE IF NOT EXISTS `imagini` (
`album_number` int(11) NOT NULL,
`id_imagine` int(11) NOT NULL AUTO_INCREMENT,
`imagine_fundal` varchar(128) NOT NULL,
`imagine` varchar(128) NOT NULL,
PRIMARY KEY (`id_imagine`),
KEY `id_album` (`album_number`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
And the PHP code:
<div id="content">
<div id="multicol">
<?php
$src_galerie = "uploads/galerie/" ;
$src_poze = "uploads/poze/";
$connect = mysql_connect('localhost', 'Darius', 'darius1990') or die('nu merge');
mysql_select_db('models', $connect) or die('nu gasesc');
$sql = "SELECT * FROM album, imagini WHERE album.id_album=imagini.album_number";
$query = mysql_query($sql, $connect);
while($row = mysql_fetch_assoc($query)){
$id_album = $row['id_album'];
$poza_album = $row['poza_album'];
$nume_album = $row['nume_album'];
$descriere_album = $row['descriere_album'];
echo "<div class='folio_box col_s for_post_$id_album'>" ;
echo "<div class='folio' style='background: url( ".$src_galerie.$poza_album . ") 0 0; height: 300px;'>";
echo "<div class='folio_mask'>" ;
echo "<div class='folio_caption'>";
echo "<div> ";
echo " <div>";
echo "<a href='#'>".$nume_album. "</a>
</div>
</div>
</div>
<div class='folio_desc'>
<div class='desc_body'>";
echo $descriere_album ;
echo "</div>
</div>
</div>
<div class='folio_just_caption'>
<div>
<div>
<a href='#'><".$nume_album. "</a>
</div>
</div>
</div>
</div>
</div>
"; } ?>
</div>
</div>
<div id="bottom">
<div>
<span>© Copyright 2011 . All rights reserved.
<ul>
<li class="ico_facebook"><a href="#" target="_blank"></a></li>
<li class="ico_twitter"><a href="#" target="_blank"></a></li>
<li class="ico_vimeo"><a href="#" target="_blank"></a></li>
<li class="ico_flickr"><a href="#" target="_blank"></a></li>
<li class="ico_tumblr"><a href="#" target="_blank"></a></li>
</ul>
<a href="#" class="go_up">Sus</a>
</div>
</div>
</div>
<!-- album's photos start -->
<?php
$sql = "SELECT * FROM imagini WHERE album_number =".$id_album;
$query = mysql_query($sql);
echo "<div class='hidden post_$id_album'>
<div class='big_gallery_bg hidden'>
<div class='big_gallery'>
<a href='#' class='go_back'>Inapoi</a>
<h1>" .$nume_album. "</h1>
<div class='multipics'> ";
while($row = mysql_fetch_assoc($query)){
$id_imagine = $row['id_imagine'];
$imagine_fundal = $row['imagine_fundal'];
$imagine = $row['imagine'];
$album = $row['album_number'];
echo "<a href=".$src_poze . $imagine_fundal . " class='go_pic' style=' background: url(". $src_poze.$imagine.")'><img height='130' src=".$src_poze.$imagine_fundal. " alt='' /><i></i></a>";
}
echo "</div>";
echo "<a href='#' class='go_back'>Inapoi</a>
</div>
</div>
</div> " ;
?>
And the link to the page: http://www.donygrig.com/models/site/index.php
Thank you very much for your help. Regards, Darius.