Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Selecting data from two tables at the same time

Posted on 2016-10-21
4
Medium Priority
?
23 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

636 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