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 1033161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:11:25+00:00 2026-05-16T14:11:25+00:00

I want to develop a system where a user should be able to post

  • 0

I want to develop a system where a user should be able to post the comments on the author published news.

I am very much confused about the Insert Statement that i should be using to store the user commenting system, i have two mysql table one is news and another is comments below is the screenshot of two tables.

news

alt text

comments

alt text

in the comments table i have defined a foreign key (new_id) , in which i want to store the value that is related to the particular news for example a news with id no. 7, how do i achieve this dynamic feat? how do i automatically relate it to the news when a user post the comment (nevertheless to say that the user will be giving the input from the form )?

EDIT : I want to use One news article on one page.

thank you

  • 1 1 Answer
  • 1 View
  • 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-05-16T14:11:26+00:00Added an answer on May 16, 2026 at 2:11 pm

    Well first off you need to know how you are going to view a news item? Is this going to have all news articles on one page and below each news article is a to post new comments? If so then each of these forms generated per news article should have the news ID in the form potentially as .

    Example:

    <p>News article 1.</p>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
       <input type="hidden" name="new_id" value="1"/>
       <textarea name="comments"></textarea>
       <input type="submit" name="submit" value="Post COmment"/>
    </form>
    
    <p>news article 2</p>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
       <input type="hidden" name="new_id" value="2"/>
       <textarea name="comments"></textarea>
       <input type="submit" name="submit" value="Post COmment"/>
    </form>
    

    Then on this page at the top you can check for whether or not user pressed submit button:

    <?php
      if(isset($_POST['submit'])){
           //$_POST['new_id'] is news article id 
           //$_POST['comments'] is comments for this 
           //sql to store new_id = $_POST['new_id'] and comments = $_POST['comments']
      {
    

    Alternatively:
    Lets say on your home page you have links to each news article and you retrieve them on subsequent page using $_GET. So index.php displays news and getNews.php is where news is displayed. You could want to on index.php generate a link to getNews.php?id=

    THis way on getNews.php you know which news article to get using $_GET[‘id’] and you can easily post comments to this using a similar technique to above, take $_GET[‘id’] and toss it into your form on getNews.php as hidden field.

    Caution: be careful and sanitize your $_GET variable before using it.
    ?>

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

Sidebar

Related Questions

I want to develop a custom window system in c++ that should not depend
I develop a Windows Service that will run under SYSTEM user. So I want
I want to develop a short url system, like bitly, and I have a
If i want to develop a registry-like System for Linux, which Windows Registry design
Possible Duplicate: Writing a Windows system tray application with .NET I want to develop
I want to develop a website where people can find useful informations about other
I want to develop an application in which user input an image (of a
I want to develop a system that is similar to calculation of salary. A
I want to develop logging system in OSGI bundle which can write application errors
I want develop a system where I can transfer some images and after run

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.