0
votes

I am keep getting this error after added inner join

SELECT 
   character.dbo.user_character.character_name,
   character.dbo.user_character.wLevel,
   character.dbo.user_character.byPCClass,
   character.dbo.user_character.wMapIndex,
   character.dbo.user_character.wPosX,
   character.dbo.user_character.wPosY,
   ban_info.dbo.account_login.ip
FROM
   character.dbo.user_character
INNER JOIN ban_info.dbo.account_login ON (character.dbo.user_character.wPosY=ban_info.dbo.account_login.ip)
WHERE (character.dbo.user_character.user_no='12100601280065')

Error

Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '127.0.0.1' to data type int.

How can I FIX IT>?

3

3 Answers

0
votes

Take a look at this; http://daipratt.co.uk/mysql-store-ip-address/. . It requires some tweaking to store an IP Address.

0
votes

Your problem is just comparing an Ip address (that is not an integer) stored on ban_info.dbo.account_login.ip by integer value stored on character.dbo.user_character.wPosY in following line :

INNER JOIN ban_info.dbo.account_login ON (character.dbo.user_character.wPosY = ban_info.dbo.account_login.ip)
0
votes

I think you should convert IP address to int in php (or db) and then compare it. There is function ip2long() in PHP