Query not working

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
echofool
Forum Newbie
Posts: 16
Joined: Mon Mar 22, 2010 1:15 pm

Query not working

Post by echofool »

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?

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 1

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
TheOnly92
Forum Newbie
Posts: 19
Joined: Thu Jan 15, 2009 6:05 am

Re: Query not working

Post by TheOnly92 »

You might want to remove the 'inner' and try again?
Post Reply