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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:58:56+00:00 2026-05-27T00:58:56+00:00

I am having difficulty to explain this problem, but I will try anyway. I

  • 0

I am having difficulty to explain this problem, but I will try anyway.

I have two different database rows

  SOMETHING
*---------------------------------------------------------*
|    id    |    category_id    |    body                  |
*---------------------------------------------------------*

  CATEGORY
*---------------------------------------------------------*
|    id    |    title    |    description                 |
*---------------------------------------------------------*

Now, I want to extract data from both rows at the samt time, how do i do this?

I need to extract values from SOMETHING and display the info from CATEGORY from the category_id in SOMETHING – how is this done the best way ?

I use to extract values like this:

$query = mysql_query("select * from SOMETHING WHERE id='$id' LIMIT 1");

while ($row = mysql_fetch_array($query)) {
   extract($row);

}
  • 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-27T00:58:57+00:00Added an answer on May 27, 2026 at 12:58 am

    Use a join

    SELECT
        S.id,
        S.category_id,
        S.body,
        C.title,
        C.description
    FROM SOMETHING AS S
    JOIN CATEGORY AS C
    ON S.category_id = C.id
    WHERE id = '42'
    LIMIT 1
    

    If there might not be a matching row in the CATEGORY table you could use a LEFT JOIN instead.

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

Sidebar

Related Questions

Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and
I'll try to explain this the best I can. I'm having quite a bit
I'm having difficulty searching for this. How would I define an element in an
I am having difficulty connecting my java code to sql server database. I can
I'm currently trying to create a ray tracer in C++ but I'm having difficulty
I'm sure someone can explain this. we have an application that has been in
I'm trying to figure why two of my Java libraries are having difficulty playing
I've stumbled on this algorithm recently and am having difficulty explaining it to myself.
I'm trying to determine the relative performance of two different queries and have two
I am having difficulty with displaying HTML it seems. haha, let me explain. I

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.