My first query where I'm trying to show the results from two separate tables (users & contact_info). I've spent a few hours Google'ing and attempting, but no luck. I think it's time to ask for help.
Basically, I can get all the information I need onto this page EXCEPT for 'b_lastname,' which is stored in the other table (contact_info).
UPFRONT:
Two tables (users, contact_info),
2 existing records (one where 'usertype=5' or admin),
data I need from users table (shown in query below),
data I need from contact_info table is -> 'b_lastname'
Here's what I have:
Code: Select all
$query = "SELECT id, file_status, affiliate, start_date, complete_date ".
"FROM users " .
"WHERE usertype != '5'";
So, the 4 bits of data in the query above are displayed for me in my page, so that works. I simply can't get the last name to show without duplicating the results. Meaning, the way I've been trying I always get 2 records; one with a last name and one without.
I'm assuming this is a JOIN situation, but I couldn't get it to work. I also tried a nested query, but that gave me a headache.
Hoping I've explained it well enough and kept it simple and someone can help.
Thank you in advance...