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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:21:39+00:00 2026-06-05T20:21:39+00:00

I cant find good solution to get information from other mysql tables when I

  • 0

I cant find good solution to get information from other mysql tables when I have Main table (PC) which are connected to other tables (cpu, ram, hdd..). In PC table there is other components IDs (cpu, ram, hdd..).

There is the code which I am using:

<?php
$query="SELECT * FROM pc ORDER by id";
mysql_query("SET NAMES 'UTF8'");
$result = mysql_query ($query);
$i=1;
echo '<table border = "1">';
echo '<tr><td><b>Nr.</b></td><td><b>CPU:</b></td><td><b>RAM</b></td><td><b>HDD</b></td><td><b>MB</b></td><td><b>GPU</b></td><td><b>Monitor</b></td></tr>';
while($nt=mysql_fetch_array($result)){
$proc = $nt['proc_id'];
$ram = $nt['ram_id'];
$hdd = $nt['hdd_id'];
$mb = $nt['mot_id'];
$gpu = $nt['gpu_id'];
$mon = $nt['monit_id'];

echo '<tr><td><b>'.$i++.'.</b></td><td>'.$proc.'</td><td>'.$ram.'</td><td>'.$hdd.'</td><td>'.$mb.'</td><td>'.$gpu.'</td><td>'.$mon.'</td></tr>';

}
echo '</table>';
?>
_______________________________
|Nr.  CPU  RAM  GPU HDD MONITOR |
| 1    1     2    1   2     2   |
---------------------------------

I’m getting the list of parts ID numbers, but instead of this I need to print real names of these components which is in other tables,not IDs. So my question is how to use IDs which are in PC table to get item name containing that ID. For example:

________________________________________________________
|Nr.  CPU        RAM      GPU        HDD     MONITOR    |
| 1  Intel    2gb adata    GTX 460   WD 1tb     LCD..   |
---------------------------------------------------------

Hope you understood my question, thanks.

  • 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-06-05T20:21:40+00:00Added an answer on June 5, 2026 at 8:21 pm

    change:

    SELECT * 
    FROM pc 
    ORDER by id
    

    to something like

    SELECT * 
    FROM PC 
    LEFT JOIN RAM on PC.Ram_ID = Ram.ID
    LEFT JOIN GPU on PC.GPUID = GPU.ID
    ...
    ORDER BY PC.ID
    

    For an improved understanding of Joins see http://www.codinghorror.com/blog/2007/10/a-visual-explanation-of-sql-joins.html

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

Sidebar

Related Questions

I have looked everywhere and surprisingly can't find a good solution to this! I've
I'm trying to get this working, and I can't find a good solution. I
Im pretty new to Java Web Services, but I cant find a good explanation
I want to have a good test setup but, I can't find a way
Would love to have a keyboard shortcut that get's the latest for a solution
I am pulling my hair out with trying to find a good solution to
I have some code (which I cannot change) that I need to get working
I have been looking for a good solution all day, but Google evolves so
I tried some, but I couldn't find the solution, somehow I managed to get
I have a issue I havn't yet been able to find a solution on.

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.