Latest updated albums on a website - Page 2 Latest updated albums on a website - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Latest updated albums on a website

Started by biellebrunner, March 29, 2016, 05:35:07 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Αndré

Sorry, I misunderstood the request. I'll post updated code soon.

Αndré

Please try this:
<?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');
    
$sql "SELECT * FROM `{$CONFIG['TABLE_PREFIX']}albums` AS a INNER JOIN `{$CONFIG['TABLE_PREFIX']}pictures` AS r ON a.aid = r.aid WHERE approved = 'YES' GROUP BY r.aid ORDER BY ctime DESC LIMIT 0 , 12";
    
$resultado mysql_query($sql$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 `{$CONFIG['TABLE_PREFIX']}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'];                             
                    }
                }
            */
            
$album_img "GALLERY URL/albums/".$row['filepath'].'thumb_'.$row['filename'].$row['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 
'\');';
?>

biellebrunner

Ok. It is getting the last updated albums. But now the album title won't show up, and the thumbnails aren't linking to their albums.  :(

Αndré

Sorry. It's quite hard to check the result with the code you provided, as I get just the HTML output and thus don't see such obvious flaws.

Please try this:
<?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');
    
$sql "SELECT *, a.title AS alb_title FROM `{$CONFIG['TABLE_PREFIX']}albums` AS a INNER JOIN `{$CONFIG['TABLE_PREFIX']}pictures` AS r ON a.aid = r.aid WHERE approved = 'YES' GROUP BY r.aid ORDER BY ctime DESC LIMIT 0 , 12";
    
$resultado mysql_query($sql$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)){
            
$album_img "GALLERY URL/albums/".$row['filepath'].'thumb_'.$row['filename'].$row['datebrowse'];                             
            echo 
'<li><div class="albimg"><img src="'.$album_img.'" alt="" /><div class="galtit"><a href="http://stanakaticbrasil.com./galteste/thumbnails.php?album='.$row['aid'].'">'.$row['alb_title'].'</a></div></div></li>';
        }
    }
    echo 
'</ul></div>';
    echo 
'\');';
?>

biellebrunner

Yes! It worked perfectly!
And no need to apologise, you're already doing so much by just giving it a try (and succeeding!).
Thank you so, so much!  ;D