Posts: 88
Threads: 16
Joined: Oct 2017
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
Posts: 493
Threads: 82
Joined: Oct 2016
Reputation:
0
Make sure in your database it is a string and not an INT.
Posts: 88
Threads: 16
Joined: Oct 2017
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
Posts: 1,794
Threads: 104
Joined: Feb 2012
Reputation:
0
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.
Posts: 88
Threads: 16
Joined: Oct 2017
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
Posts: 88
Threads: 16
Joined: Oct 2017
Posts: 217
Threads: 1
Joined: Jul 2017
Reputation:
0
Toggle off case sensitivity. Maybe it's because of a !strcmp function with third parameter false.
Posts: 88
Threads: 16
Joined: Oct 2017
how to do that?
I am learning mysql i dont know
Posts: 88
Threads: 16
Joined: Oct 2017
push... Someone has an example?
Posts: 244
Threads: 4
Joined: Apr 2010
Reputation:
0
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.