Hi. Soryr if this is in the wrong place, I wasn't sure if this was to go under plugins, bridges, or something else.
Anyway, I wanted to display the latest updated albums from my gallery on my site. I thought I'd found a way to do that, but it actually shows only the last albums that were created.
This is the code I have:
<?php
require_once('include/config.inc.php');
header("Content-type: application/x-javascript");
$connect = mysql_connect($CONFIG['dbserver'],$CONFIG['dbuser'],$CONFIG['dbpass'])
or die('Error connecting to the server');
$connect_db = mysql_select_db($CONFIG['dbname'], $connect)
or die ('Error connecting to the database');
$resultado = mysql_query("SELECT * FROM `cpg_albums` ORDER BY `cpg_albums`.`aid` DESC LIMIT 0 , 12", $connect)
or die('No albums found with this query');
echo 'document.write(\'';
if(mysql_num_rows($resultado) == 0){
echo 'No albums created';
} else {
echo '<div class="wrapper"><ul>';
while($row = mysql_fetch_array($resultado)){
echo ' ';
$album_id = $row['aid'];
$subresult = mysql_query("SELECT * FROM `cpg_pictures` where aid=$album_id order by pid DESC LIMIT 0, 12");
if(mysql_num_rows($subresult) == 0){
$album_img = "GALLERY URL/thumbs/thumb_nopic.png";
} else {
while($subrow = mysql_fetch_array($subresult)){
$album_img = "GALLERY URL/albums/".$subrow['filepath'].'thumb_'.$subrow['filename'] .$subrow['datebrowse'];
}
}
echo '<li><div class="albimg"><img src="'.$album_img.'" alt="" /><div class="galtit"><a href="http://stanakaticbrasil.com./galteste/thumbnails.php?album='.$album_id.' ">'.$row['title'].'</a></div></div></li>';
echo '';
}
}
echo '</ul></div>';
echo '\');';
?>
Is there something I can change in this code to get the output I want?
Thank you.