Solved

Selecting data from two tables at the same time

Posted on 2016-10-21
4
19 Views
Last Modified: 2016-10-21
Can i select data from two tables with a single sql sentence and use fetch_assoc and while loop to print the mixed data coming from two tables?
0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Evan Cutler
ID: 41854486
can you please put in code you have already worked on?  This may become easier to answer if we know what we are dealing with.  Thanks.
0
 
LVL 1

Author Comment

by:Braveheartli
ID: 41854495
I'm out of office right now, however what i want to learn is : can i select data like this and print it out with fetch function and while loop?

SELECT * FROM member
LEFT JOIN networking
ON member.networkingID=networking.ID
WHERE member.ID=2
0
 
LVL 9

Accepted Solution

by:
Evan Cutler earned 500 total points
ID: 41854497
yes.  but using the asterik(*) provides an issue of names identical in both tables.
in order to fetch across the resulting dataset, you will be sucked into a fully qualified column name (ie. networking.column1 and member.column1).  you might want to qualify those names first (ie. netcol1 and memcol1) and use individual columns names instead of the asterik(*).
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41854501
Thank you
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question