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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:39:21+00:00 2026-05-25T12:39:21+00:00

I have created a comment box successfully using PHP with MySQL. The comment table

  • 0

I have created a comment box successfully using PHP with MySQL. The comment table structure is:

CommentID PK AI
Name
Email
Comment
CommentDateTime

I didn’t use an ID to identify the page that is being commented on because I’m using this in only one.

When a user is logged in, the input field for name and email will disappear and the user’s name and email that is stored in a session variable will be used. All works fine, but I need to use the user picture that is saved in MySQL to display in the comment box.

Should I add a UserID in the comment table? What if the comment is from a non-user, then should I just add null or 0? I’m quite confused on how to work with comment box using user picture.

  • 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-05-25T12:39:21+00:00Added an answer on May 25, 2026 at 12:39 pm

    You are trying to relate information from 2 tables since you want to use the picture if the user is registered therefore you need a relation to make the connection between the 2. So yes, you will need the UserID field on the table to make the connection.

    If it comes from an unregistered / not-logged user, then you can set USER_ID to null.

    If the comment is from a logged user you can then leave the name in the comment table blank and retrieve it from the user table (same goes for the email). This way you will be avoiding data redundancy. (Assume you have a registered user that leaves a ton of comments, without a user id you will be storing his name and email a ton of times that you don’t need).

    I hope that helps.

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

Sidebar

Related Questions

I have created one html form with following fields: Name (Text Box) Email (Text
I have the following table Created Comment 2010/10/10 Text1 2010/11/11 Text2 2010/12/12 Text3 I
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a PHP-script to update a web server that is live inside
I have created a C# class file by using a XSD-file as an input.
I want to create a table for making a comment box. I was told
I have created an article comment for my user to post comment. I also
I have created one windows service which send an email notifications to users (list
I have created combo box that I would like to load with all of
I have created a DisplayTemplate for a Comment class, and placed it inside Comment/DisplayTemplates/Comment.cshtml

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.