Page 1 of 1

Re: JOIN mysql php

Posted: Sun Jun 28, 2015 3:11 pm
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