PDA

View Full Version : MYSQL: Save IP problem


pulsare
11/01/2018, 03:52 PM
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:

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

aoky
11/01/2018, 04:13 PM
Make sure in your database it is a string and not an INT.

pulsare
11/01/2018, 06:27 PM
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

Beckett
11/01/2018, 08:58 PM
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.

pulsare
12/01/2018, 01:26 PM
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

pulsare
12/01/2018, 03:02 PM
/////

Lucases
12/01/2018, 03:46 PM
Toggle off case sensitivity. Maybe it's because of a !strcmp function with third parameter false.

pulsare
12/01/2018, 06:54 PM
how to do that?

I am learning mysql i dont know

pulsare
13/01/2018, 09:58 AM
push... Someone has an example?

GangstaSunny.
13/01/2018, 10:02 AM
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.

pulsare
13/01/2018, 10:40 AM
push