Query not working
Posted: Sun Apr 18, 2010 4:45 pm
Hey,
I use this query to check if a user has a smiliar IP to another user... yet it doesn't work... me and my friends ip's have a match but the query returns 0 suggesting there was no IP match....
Can some one explain what i got wrong?
Table Fields:
Row 1:
RecordID 1
IP 127.0.0.1
UserID 1
Row 2:
RecordID 2
ID 127.0.0.1
UserID 2
Row 3:
RecordID 3
ID 127.127.127.127
UserID 1
I use this query to check if a user has a smiliar IP to another user... yet it doesn't work... me and my friends ip's have a match but the query returns 0 suggesting there was no IP match....
Can some one explain what i got wrong?
Code: Select all
SELECT t1.IP
FROM iplogs t1
INNER JOIN iplogs t2 ON t1.IP = t2.IP
WHERE t1.userID='$UserID1' AND t2.UserID='$UserID2'
LIMIT 1Table Fields:
Row 1:
RecordID 1
IP 127.0.0.1
UserID 1
Row 2:
RecordID 2
ID 127.0.0.1
UserID 2
Row 3:
RecordID 3
ID 127.127.127.127
UserID 1