Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How can I display the three last added album  (Read 5436 times)

0 Members and 1 Guest are viewing this topic.

mauba

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
How can I display the three last added album
« on: June 19, 2008, 08:22:17 pm »

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

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: How can I display the three last added album
« Reply #1 on: June 19, 2008, 08:48:07 pm »

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.

Code: [Select]
<?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.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: How can I display the three last added album
« Reply #2 on: June 20, 2008, 02:06:53 pm »

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 ?
Logged

mauba

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: How can I display the three last added album
« Reply #3 on: June 20, 2008, 02:08:58 pm »

Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: How can I display the three last added album
« Reply #4 on: June 20, 2008, 04:30:32 pm »

Its because you have not properly connected to MySQL or your login does not have the correct permissions etc.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: How can I display the three last added album
« Reply #5 on: June 20, 2008, 08:59:14 pm »

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.

Logged

mauba

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: How can I display the three last added album
« Reply #6 on: June 25, 2008, 03:29:57 pm »


How can I do it with cpmfetch ?
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 15 queries.