coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: antisa33 on July 01, 2006, 04:15:57 AM

Title: last uploads order by mtime ?
Post by: antisa33 on July 01, 2006, 04:15:57 AM
Hello
I have done a script and now i need to sort my lastuploads files by date (the new one before).
I know it is in include/funtions.inc.php in
"case 'lastup': // Last uploads"
Now it is ordered by "pid", how to change, and to sort by date ?
i have
if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid';
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

i tried with mtime

if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid, mtime';
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY mtime DESC $limit");
but it is not ok  ???
What is the real code ?
Thanks
Title: Re: last uploads order by mtime ?
Post by: Nibbler on July 01, 2006, 04:05:01 PM
Sorting them by mtime makes no sense, use ctime.
Title: Re: last uploads order by mtime ?
Post by: antisa33 on July 01, 2006, 07:24:50 PM
Thanks for the reply.
So i need to sort by ctime.
Please can you tell me how to have the ctime of today :
something like that :
$date = date("Y-m-d");
$time = date("H:i:s");
$ctime = ??

I found !

It is

$ctime=time();

Thank you very much for help
Bye