Page 1 of 1

Limiting amount of comments posted

Posted: Wed Feb 05, 2003 1:14 am
by Shinmeiryu
The core of my newsposting script comes with users being able to post comments (user reviews) for each article.

How would I go about placing a limit on how many comments can be posted for each article according to how many are displayed? Not necessarily according to ID because I given the script the ability to have comments deleted.

Basically, I only want #num as the maximum amount of comments to be allowed for posting then have a block placed on it.

Posted: Wed Feb 05, 2003 6:37 am
by patrikG
Have a column in your database "commentsNumber" or sumfink. Otherwise, do a mysql_num_rows().

Posted: Wed Feb 05, 2003 2:40 pm
by McGruff
Do you mean limit the number of comments displayed per page without limiting the total number allowed?

If so, I'll send you a script I use.

Posted: Wed Feb 05, 2003 7:55 pm
by Shinmeiryu
Not just display but allowing the limit of posts. I have it figured out now though through using mysql_num_rows, thanks.

Posted: Fri Feb 07, 2003 5:13 am
by redcircle
if you just want to limit the number displayed like the last 5 at the end of the query just put limit 5

select comment from newscomments where news_id='1' order by id desc limit 5

that will get the last 5 posted comments on the news article 1. not knowing the database setup of course.