Mysql Query question -
yvoms - 26.05.2014
Greetings
I am currently trying to set up my samp basic player info in mysql
But i want the ip a player registered on and a recent IP stored both,
So i made 2 diffrent rows, RecentIP and RegisterIP, but the query im using at the moment is not correct i gues..
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `Admin`, `Vip`, `Money`, `Score`, `XP` ,`RegisterIP`, `RecentIP`)
VALUES ('%e', '%s', 0, 0, 0, 0, 0.0, 0.0, 0.0)", Name[playerid], pInfo[playerid][Password], IP[playerid]);
mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
Full script :
http://pastebin.com/EZTEQFz7
Re: Mysql Query question -
ShoortyFl - 26.05.2014
I didnt really understood the inserting function in your code, but, here you go !
http://pastebin.com/ryRR5C21
I've edited the Table Name for IP you can set it as you like, if it doesn't work let me know.
Re: Mysql Query question -
yvoms - 26.05.2014
ShoortyFl i didnt really see what you did, My bad for that, but
All i want is the sql query to be fixed since i don't think it will work like this.
I just want it to store
Username, Password, Admin, Vip, Money, Score, XP, RegisterIP, RecentIP
Thanks.
Re : Mysql Query question -
S4t3K - 26.05.2014
Create a table called players, create at least 9 columns, then store the gotten values inside.
What's the problem ?
Re: Mysql Query question -
Riddick94 - 26.05.2014
Does `RegisterIP` stays always the same? And `RecentIP` is basically the IP player just connected with? Am I right or am I wrong?
edit:// @down,
OnPlayerConnect callback. What is really hard to look for it on your own?
Re: Mysql Query question -
Fred1993 - 26.05.2014
why are you using %e for username ?
VALUES ('%e', '%s', 0, 0, 0, 0, 0.0, 0.0, 0.0)
Where are you storing the ip[playerid]
Re: Mysql Query question -
yvoms - 26.05.2014
Yes riddick,
Registered ip stays the same and recent ip is the last ip a player connected from, %e is a mysql string anti dql injection
Re: Mysql Query question -
Fred1993 - 26.05.2014
ok well you'r not storing the ip's
the query must be like
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `Admin`, `Vip`, `Money`, `Score`, `XP` ,`RegisterIP`, `RecentIP`)
VALUES ('%e', '%s', 0, 0, 0, 0, 0.0, '%s', '%s')", Name[playerid], pInfo[playerid][Password], IP[playerid], recentip[playerid]);
Re: Mysql Query question -
Konstantinos - 26.05.2014
Just insert the same player's IP once they register (IP[playerid] twice as argument) and when they login in the future, execute a query with UPDATE clause
pawn Код:
..., "UPDATE players SET RecentIP='%e' WHERE UserName='%e'", IP[playerid], Name[playerid]);