mas gostaria de pedir mais um pouco, mudei td certo, só q tenho 2 galerias cadastradas e só a primeira aparece o thumbs, poderia dar uma olhada no codigo pra ver se eu alterei algo errado
<table width="540" cellpadding="0" cellspacing="0" class="style1">
<tr>
<?
require "conectbd.php";
$sql = "select * FROM cpg132_albums ORDER BY aid DESC";
$resultado = mysql_query($sql) or die ("Erro 1: ".mysql_error());
$cont =1;
while ($linha=mysql_fetch_array($resultado)) {
$aid = $linha["aid"];//id do album
$title = $linha["title"];//titulo do album
$thumb = $linha["thumb"];//se o album tem destaque
if ($thumb == "0")//se nao tiver destaque
{
$ordem = "ORDER BY pid DESC LIMIT 1";//pega a 1ª foto do album
}
else
{
$ordem = "AND pid = '$thumb'";//pega a foto destaque se tiver
}
//===================================================
$sql_foto = "SELECT * FROM cpg132_pictures where aid = '$aid' $ordem";
$resultado_foto = mysql_query($sql_foto) or die ("Erro 1: ".mysql_error());
while ($linha=mysql_fetch_array($resultado_foto)) {
$filepath = $linha["filepath"];//pasta do album
$filename = $linha["filename"];//nome da foto destaque do album
?>
<td height="10">
<div align="center"><a href="coppermine/thumbnails.php?album=<? echo $aid; ?>"><img src=mostrafoto.php?imagem=coppermine/albums/<? echo $filepath; ?>/<? echo $filename; ?>&tam=120 border=0></a><br>
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="coppermine/thumbnails.php?album=<? echo $aid; ?>"><? echo $title; ?></a></font></strong></div></td>
<?
}
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
<?
{
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
</td>
</tr>
</table>