Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:46:16+00:00 2026-06-05T14:46:16+00:00

So I have a comments section on my website (blog style), so every post

  • 0

So I have a comments section on my website (blog style), so every post has a comments section.

I have a table ‘posts’ fields (post_id, isComment, title, timestamp, post etc.)

isComment is a boolean value which refers to if the post has any comments. If 0, no comments are searched for or shown, if 1, querys the table comments for comments for that post.

There’s also a table ‘comments’ which has fields (comment_id, post_id, created etc..)

The post_id is the post the comment corresponds to.

Currently the query to remove a comment is:

 "REMOVE FROM comments WHERE comment_id = '$id';"

What I want to know, is if there is any way to find out if the comment deleted was the last comment corresponding to that post?
And if so, then I would change the isComment value of that post to 0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:46:18+00:00Added an answer on June 5, 2026 at 2:46 pm

    You can fire a query to find number of comments for that post, after every delete of a comment.

    Something like.

    select count(*) from comments where post_id = (select post_id from comments where comment_id='$id')
    

    // You can optimize the query if u want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two table named: Blog for displaying blogs post and comments for displaying
I have a simple question and answer section on my website that allows comments.
A user can create a post. Posts have comments. A comment must belong to
I have recently added a comments section to a blog. Codeigniter says to always
I have a Pictures section on my website and allow users to enter comments
I have a very simple website, and would like to create a 'Comments' section
I have a comments section on a website i'd like to streamline a bit
Here's what I need to fetch: - posts that have comments - number of
I'm creating a Django powered website that will have numerous applications (Blog, Shop, Portfolio,
I want to have a comments section in my app that looks like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.