How can I display the three last added album How can I display the three last added album
 

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

How can I display the three last added album

Started by mauba, June 19, 2008, 08:22:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mauba

How can I display the three last added album and their names om my home page ?

just_some_guy

The actual time that the album was created is not logged, however this is possible by ordering the results by the album id (aid) field as this is an auto_increment field; meaning the id of each album is bigger the later it is created.

This assumes that your "home page" is outside coppermine.


<?php
/*Assuming you have already connected to the database. */
$prefix 'cpg14x_';
$lastalb mysql_query("SELECT title FROM {$prefix}albums ORDER BY aid DESC LIMIT 3");
echo 
'The latest albums are - <ul> ';
while (
$row mysql_fetch_array($lastalb)) {
echo 
'<li>'.$row['title'].'</li>';
}
echo 
'</ul>';
?>



Adjust the $prefix variable to suit your gallery prefix.

PS - This is not using cpmFetch.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

mauba

Look at my page.

The pics display are calling with cpmfetch

The error is code that you sent. do you I have to declare the user and password in the code ?

How can I do ?


just_some_guy

Its because you have not properly connected to MySQL or your login does not have the correct permissions etc.
Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

mauba

I want to display not private albums.

What´s wrong ?

Is it necessary declare the password ?

I put the code on my home page to call the albums from cpm but the albums aren´s shown.


mauba