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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:20:52+00:00 2026-05-29T06:20:52+00:00

I have 2 tables, I have to get the data of one table using

  • 0

I have 2 tables, I have to get the data of one table using where = "this value in some other table"

users_info and users_frnds

users_info look like this

   name          image       presently      id
 somename      somimage         studying     2
 somename      somimage         studying     3

users_frnds table looks like this

  userid     friendid
     1          2
     1          3

$query = "SELECT * FROM users_info WHERE users_info.id =
users_frnds.friendid";
 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['name']. " - ". $row['image'];
echo "<br />";

but it does not seem to work here. I wanted to get all the data at once into my array.

It throws me this error:

Unknown column 'users_frnds.friendid' in 'where clause'
  • 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-29T06:20:53+00:00Added an answer on May 29, 2026 at 6:20 am

    You will need to join, like:

    SELECT specifyfields 
    FROM users_friends 
      INNER JOIN users_info ON users_info.id=users_friends.friendid
    

    Then you will get access, try never to join tables in the WHERE clause because that can create quite unreadable queries.

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

Sidebar

Related Questions

I have to get data from Oracle Table in which I have one datefield
Parsing some data and inserting it into 3 tables from .NET. Using Table Valued
I have 2 tables , one showing me customer addresses and one other table
I have two tables that get joined regularly. Table One is about 1 Million
I have two tables in this project of mine. One table is for the
I have a main table that I must get data from. I have a
I have two tables with a weak relation. I need get a text value
How to get the data and display from more than one table in android?
I have 3 tables which contain different types of data related to each other.
I created two temp tables, one table is for orders and the other is

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.