forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: zom on April 26, 2006, 09:32:16 pm

Title: help with comments
Post by: zom on April 26, 2006, 09:32:16 pm
I have change line 2323 in theme.inc to limit the number of comments to 20 :

 $result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id $comment_sort_order LIMIT 20");

But I wuold like the lasts comment to be shown, how to do that ?

Could it be possible to errase oldest comments when a new one is entered ?

thanks

Title: Re: help with comments
Post by: Nibbler on April 26, 2006, 09:34:35 pm
Change

Code: [Select]
ORDER BY msg_id
to

Code: [Select]
ORDER BY msg_id DESC
Title: Re: help with comments
Post by: zom on April 27, 2006, 07:39:24 am
thanks foryour help, but adding "DESC" :

author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id DESC $comment_sort_order LIMIT 50"

gives me an error : error of request
Title: Re: help with comments
Post by: Stramm on April 29, 2006, 09:17:28 am
of course you should remove then the variable that holds the sort order... otherwise you have it double in the satatment what leads to an error

ORDER BY msg_id DESC LIMIT 20
Title: Re: help with comments
Post by: zom on April 29, 2006, 02:40:06 pm
many thanks for your help !

to remove older comments than the last 50 ones is a way to do it (even if it is manually by a mysql request in php myadmin) ?
Title: Re: help with comments
Post by: Joachim Müller on April 30, 2006, 09:39:30 am
one issue per thread, see http://forum.coppermine-gallery.net/index.php?topic=22469.msg140696#msg140696