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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:38:06+00:00 2026-05-29T07:38:06+00:00

Hello all I have a table comment as follows commentid cmt followupid category 1

  • 0

Hello all I have a table

“comment” as follows

commentid      cmt                followupid    category 

1            hello                   3           starting 
2            hi how are you          4           starting
3            Hello Jhon              5           followup
4            Hi I am fine and you    6           followup

I want to echo the records such that When I echo Hello the next comment that will appear is Hello John, when I echo Hi how are you the next comment that will appear is Hi I am fine and you.
I have tried to

$myQuery = "SELECT * FROM comment where category = 'followup'  AND followupid = commentid "; 

but it is not working.

  • 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-29T07:38:06+00:00Added an answer on May 29, 2026 at 7:38 am

    The query as specified will get the results where the followupid is equal to commentid, and you don’t have any of those in your example.

    For it to work you need to explicitly specify the commentid you’re looking for:

    SELECT * FROM comment where category = 'followup' AND followupid = 3

    in case of PHP, you get this from the current record you’re printing:

    echo $row['cmt'];

    mysql_query("SELECT * FROM comment where category='followup' and followupid={$row['followupid']}");

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

Sidebar

Related Questions

I have a table comment as follow: Comment comment_id cmt followupid 1 Hello 3
hello all this seems to be my problem I have a table in mysql
Hello I have a single friends table as follows: Id Sender Recipient Where sender
Hello all I want to make the div's I have inside my td's act
Hello all I have 2 tables...anyway in jQuery to make table@ the same width
Hello I have a table that may have many rows. I want to modify
I have one de normalized table. I want to select all the values from
hello all I have a small dialog which I created dynamically, which has a
hello all i am working on a project in which i have a webpage
Problem Hello all! I have this code which takes my jpg image loops through

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.