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

The Archive Base Latest Questions

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

I have encountered a unique problem. I have two tables, one for clients and

  • 0

I have encountered a “unique” problem. I have two tables, one for clients and second for their users. The third table is a comments table. So when a comment is added to the third table, the posting persons id and the organizations manager whom the comment is pertaining to, his id is stored. Now when i have to show the comments i am not sure how to get the appropriate names as they are stored in two different tables.

Any ideas on how to do this?

Some code that i manage to create:

   $query="SELECT v_comments.v_comment_id, d_names.d_name,
   v_comments.visit_reply, v_comments.just_date FROM v_comments 
   LEFT JOIN d_names ON v_comments.d_id = d_names.d_id 
   WHERE v_id = '$vid' and v_comments.s_id='$sid' ORDER BY v_comments.id DESC";  
   $result=mysql_query($query);

   $num=mysql_numrows($result);

   mysql_close();

  echo "";

   $i=0;
   while ($i < $num) {

$reply=mysql_result($result,$i,"v_reply");
$replyid=mysql_result($result,$i,"v_comment_id");
$dname = mysql_result($result, $i, "d_name");


echo "";

echo "";

 $i++;
  }
  • 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-21T21:39:15+00:00Added an answer on May 21, 2026 at 9:39 pm

    Do you just need to add a join to the other table, and SELECT the other name field?

    This should work if the other table is called “s_names” (I had to guess at that):

    SELECT v_comments.v_comment_id, d_names.d_name, s_names.s_name,
           v_comments.visit_reply, v_comments.just_date
    FROM v_comments
    LEFT JOIN d_names ON v_comments.d_id = d_names.d_id 
    LEFT JOIN s_names ON v_comments.s_id = s_names.s_id 
    WHERE v_id = '$vid' and s_id='$sid' ORDER BY v_comments.id DESC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have encountered a problem that I have not come accross yet when setting
I'm migrating a TSQL stored procedure to PL/SQL and have encountered a problem -
I am using ajaxForm. Now I have encountered a problem. My idea is when
When making relations between tables (in mysql), I have encountered a naming dilemma. For
I've encountered a problem with JSP pages server-side caching. Suppose I have an internal
I have two tables that are related, which, for the purpose of this question,
I have encountered with a problem with pricing. I need to format price input
I have encountered a weird problem twice in the past 2 weeks and it's
I have encountered the following problem which proved to me that I know far
I have a script that appends some rows to a table. One of the

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.