Limiting amount of comments posted

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Shinmeiryu
Forum Commoner
Posts: 29
Joined: Wed Nov 13, 2002 2:57 am

Limiting amount of comments posted

Post 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.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Have a column in your database "commentsNumber" or sumfink. Otherwise, do a mysql_num_rows().
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post 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.
User avatar
Shinmeiryu
Forum Commoner
Posts: 29
Joined: Wed Nov 13, 2002 2:57 am

Post by Shinmeiryu »

Not just display but allowing the limit of posts. I have it figured out now though through using mysql_num_rows, thanks.
User avatar
redcircle
Forum Commoner
Posts: 43
Joined: Fri Jan 31, 2003 8:47 pm
Location: michigan, usa

Post 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.
Post Reply