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 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 in one of my Java projects, which causes bugs.
I have encountered a problem of placing data into the Table View. Here is
I have encountered a unique problem. I am doing a simple ajax call using
I have encountered a problem with creating a thumbnail from an uploaded image file,
I have encountered a weird problem, when i built my last ad-hoc version for
I have encountered a most annoying problem that occurs on the PWD variable when
I have encountered a rather nasty problem with the DataGridView control (Windows.Forms, .NET Framework
I have encountered a problem twice now whereby a producer thread produces N work
We have encountered a very strange class not found problem in our web app
Here is a situation I have encountered: I have two similair java application running

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.