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

  • Home
  • SEARCH
  • 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 3627538
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:54:04+00:00 2026-05-18T23:54:04+00:00

Hey guys, I have a website that has a url that looks sorta like

  • 0

Hey guys, I have a website that has a url that looks sorta like this:
http://www.domain.com/photos.php?id=(image id);
Now, my question is, how can I add comments to each picture using mysql and php.

  • 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-18T23:54:05+00:00Added an answer on May 18, 2026 at 11:54 pm

    You will probably want a new table to link the user with the comment with the picture:

    table: comments

    id (comment id), user (user id), picture (pic id), comment (text), date(timestamp w/default current time)
    

    Then after you show the image, do another query for any comments:

    $comments_query = mysql_query("SELECT comment FROM comments WHERE picture = $id");
    while($comments_result = mysql_fetch_array($comments_query)){
       echo($comments_result['comment']);
    }
    

    You will also probably want to link each user’s username to the comment as well:

    $comments_query = mysql_query("SELECT comments.comment, users.username, comments.date FROM comments INNER JOIN users ON comments.user = users.id WHERE comments.picture = $id");
    while($comments_result = mysql_fetch_array($comments_query)){
        echo($comments_result['date']);
        echo($comments_result['username']);       
        echo($comments_result['comment']);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have developed a small site that i would like to embed
Hey guys I have my own webserver that is hosting a website that I
Hey guys, I have an idea that I'd like to start implementing that at
Hey guys i have been trying to download it from the below link http://www.enterprisedb.com/products-services-training/pgdownload
hey guys, i have a sitemap with h3's and ul's like this: <div id=ajax-base>
hey guys, i have a probably rather simpel problem: my website has two layers:
hey guys, i have a certain plugin on my website that adds a inline
Hey guys I have an array like this print_r($grouparray); Array ( [0] => Array
Hey guys I have an admin page that checks if you are admin before
Hey guys I have one more question lol. I am using a script that

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.