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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:01:03+00:00 2026-05-26T12:01:03+00:00

Here is how the the database is layout. I can connect to DB fine.

  • 0

Here is how the the database is layout. I can connect to DB fine.
I had it pullling from database two things but adding a third i can not get it to pull. I just need some help if i could ..

database - mmoore_drupal

table 1

table name = content_type_uprofile

data
vid= 19723
nid =19674
field_name_value = matthew moore


table 2

table name  = location_instance

data

lid = 1521
vid = 19723
nid = 19674

table 3

table name = location

data

lid = 1521
street =
city =
country =
latitude =
longitude = 

I am trying to pull name and then other info from the other two tables. But mainly i need to have name and other information from location. I thought i had to have the other table to associate the connection. Any help is appreciated.

$query = "SELECT content_type_uprofile.field_name_value,location.street,location.city
    FROM location_instance,location,content_type_uprofile
       WHERE location_instance.lid = location.lid and                               location_instance.nid=content_type_uprofile.nid"

$result = mysql_query($query) or die(mysql_error());


// Print out the contents of each row into a table 
while($row = mysql_fetch_array($result)){
    echo $row['nid']."-".$row['street']. " - ". $row['city'];
    echo "<br />";
}
?>
  • 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-26T12:01:04+00:00Added an answer on May 26, 2026 at 12:01 pm

    Use this SQL (explicit join syntax):

    SELECT
      content_type_uprofile.nid,
      location.street,
      location.city
    FROM
      content_type_uprofile
    INNER JOIN location_instance
      ON (content_type_uprofile.nid = location_instance.nid)
    INNER JOIN location
      ON (location_instance.lid = location.lid)
    

    The SQL that you posted is using implicit join SQL syntax.

    I think for some reason, I think the line in your SQL:

    WHERE location_instance.lid = location.lid and location_instance.nid=content_type_uprofile.nid
    

    is filtering out all the rows from your result set. I’m not sure because I avoid the implicit syntax.

    You were also missing the nid field which your PHP code is looking for in the result set.

    As long as your data is correct (i.e. the fields that you are joining on have the right values), the SQL that I posted will work for you.

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

Sidebar

Related Questions

I'm using sphinx to list me some items from my database here. It's almost
Here is a simplified version of my database model. I have two tables: Image,
Here's the situation: we have an Oracle database we need to connect to to
I've read similar posts on here but I can't get results with those answers.
After deleting from database my ListView does not update , I found a method
We have an Oracle database here that's been around for about 10 years. It's
I am trying to map a legacy database here and I'm running into a
I have posted a question about multilanguage database design here, [] What are best
Just getting into SQL stored queries right now... anyway, here's my database schema (simplified
Here is my current setup: Database Role - MyDbRole Schema - MySchema User -

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.