JOIN mysql php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: JOIN mysql php

Post by Celauran »

$visitor_id does not appear to be defined within the scope of that function, which is why they're all zero. Also, when you're joining tables, you need to tell it which fields to join on.

Code: Select all

SELECT u.username, v.some_field
FROM users AS u
INNER JOIN visitors AS v ON u.visitor_id = v.id
WHERE something whatever
Post Reply