MYSQL: Save IP problem
#1

I am new & learning mysql. If I want to save IP from a Player, my databse is creating a new player

with the ip 127 (full ip would be 127.0.0.1 (localhost))


Here my Code:

Quote:

new name[MAX_PLAYER_NAME],queryzz[128],IP[35];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerIp(playerid, IP, sizeof(IP));
format(queryzz,sizeof(queryzz),"INSERT INTO user (username,playerip) VALUES ('%s','%s') ",name,IP);
mysql_pquery(dbhandle,queryzz,"","",playerid);


Here my MYSQL Databse:

https://www.pic-upload.de/view-34638580/pat.png.html
Reply
#2

Make sure in your database it is a string and not an INT.
Reply
#3

Quote:
Originally Posted by aoky
Посмотреть сообщение
Make sure in your database it is a string and not an INT.
Thx the Ip gets completly saved now but there is another problem.

When Iam going online with my Account Tec9 & when I come again with

for example "tec9" it creates a new user with the name "tec9".

https://www.pic-upload.de/view-34639529/sssd.png.html
Reply
#4

Pretty sure that's a lowercase 't' and the other is an uppercase, no? Do you want to prevent that from happening or what's the issue?

PS: You should hash the passwords.
Reply
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Pretty sure that's a lowercase 't' and the other is an uppercase, no? Do you want to prevent that from happening or what's the issue?

PS: You should hash the passwords.
what ? Didnt understand anything except hashing pw
Reply
#6

/////
Reply
#7

Toggle off case sensitivity. Maybe it's because of a !strcmp function with third parameter false.
Reply
#8

how to do that?

I am learning mysql i dont know
Reply
#9

push... Someone has an example?
Reply
#10

INSERT INTO will always create new stuff. Check if the Entry (username) already exist and just SELECT the info. There are tons of good written, newbee-friendly tutorials. I also learned with them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)