Hi, I'm currently programming a little gallery script of my own, but I'm having some problem on the following code segment:
$query = mysql_query("SELECT * FROM albums ORDER BY id ASC LIMIT 3");
while ($fetch = mysql_fetch_array($query))
{
if (!empty($fetch['name']))
{
$album_name = $fetch['name'];
echo "<div class='floatleft'>
<td><p><strong>Album: </strong></td>
<td><a href='gallery.php?album=" . $fetch['name'] . "'>" . $fetch['name'] . "</a></p></td></tr>
<div class='clear'></div>
</div>
<tr>";
$query = mysql_query("SELECT * FROM gallery WHERE album = '$album_name' ORDER BY RAND() LIMIT 3");
while ($get = mysql_fetch_array($query))
{
if (!empty($get['source']))
{
echo "<div class='floatleft'><td><img src='Images/Gallery/" . $get['source'] . "' class='gallery_thumb' title='" . $get['name'] . " style='clear:both;' /><br /><p>" . $i . "Namn: " . $get['name'] . " </p>
<p><span style='font-size:9px;color:#CCC;'>" . $get['album'] . "</span></p></td></div>";
}
else
{
echo "<p>Detta album är tomt.</p>";
}
}
}
Link to script in-action: http://www.pcstodet.se/Kunibakai2/gallery.php
What i'm trying to achieve is the three latest subscripted albums to be written, with three randomly ordered images from the correspondent album.
However, as you can see in the link i gave you, i'm only successful with writing one album at a time. In other words, my album-while loop isn't looping.
Any ideas why?