my acc won't save on the database. -
HeroDR22 - 03.06.2018
I have a problem with my reg system the problem is when you register to the server the acc won't save on the database so that's mean when i relog with my acc i registered its tell me to register again.
here is the code:
pawn Код:
stock RegisterPlayer(playerid)
{
new password[144];
GetPVarString(playerid, "Password", password, sizeof(password));
new Query[144];
mysql_format(mysqlHandle, Query, sizeof(Query), "INSERT INTO `players` SET \
`username` = '%e', \
`password` = sha1('%e')",
pName(playerid),
password);
mysql_tquery(mysqlHandle, Query, "OnPlayerRegister", "d", playerid);
GivePlayerMoney(playerid, 2500);
SetPlayerScore(playerid, 1);
}
Any problem in this code?
Re: my acc won't save on the database. -
k2bi - 03.06.2018
I recommend you use inc DOF2 which is easier to use and understand
Re: my acc won't save on the database. -
HeroDR22 - 03.06.2018
I don't know this include.
And i don't know how to use it.
Re: my acc won't save on the database. -
Sew_Sumi - 03.06.2018
Ignore the random suggestions to use old outdated includes.
You should be looking into more updated tutorials about registration systems, and I'd also say you don't need the pVar... They're slow, and it's not as if your registration/login system is going to need to share the variable.
Re: my acc won't save on the database. -
HeroDR22 - 04.06.2018
I see the problem "The problem is when i add a colums like skin, job in players.sql" But why?
That's the problem And i don't know how to fix it.
If i didn't add any colums the reg sys will be working fine, If i add a colum it will not save any acc in the sys.
Re: my acc won't save on the database. -
Sew_Sumi - 04.06.2018
You do realise you didn't say that in the original post right?
You should put as much detail as you can into your thread, as what'll happen is when you put up one line of 'my code is broken, how to fix' you won't get anything, but if you said what you were doing and how it was failing, you're much more likely to get a valuable answer.
Re: my acc won't save on the database. -
GTLS - 04.06.2018
You are using wrong format for insert. correct format is,
PHP код:
INSERT INTO players (Column 1, Column 2,...) VALUES (value 1, value 2,...);
Re: my acc won't save on the database. -
SyS - 04.06.2018
Quote:
Originally Posted by GTLS
You are using wrong format for insert. correct format is,
PHP код:
INSERT INTO players (Column 1, Column 2,...) VALUES (value 1, value 2,...);
|
Insert with SET is a valid syntax (
https://dev.mysql.com/doc/refman/8.0/en/insert.html)
@OP: when ever you ask a question provide some information with it. For example what all did you try,logs,details of dependencies and platform,constraints in each field etc.Don't just post code that you might think is source of problem.
Re: my acc won't save on the database. -
Sithis - 04.06.2018
Quote:
Originally Posted by HeroDR22
I see the problem "The problem is when i add a colums like skin, job in players.sql" But why?
That's the problem And i don't know how to fix it.
If i didn't add any colums the reg sys will be working fine, If i add a colum it will not save any acc in the sys.
|
Check your INSERT statements. If you do not allow NULL values into your new column, then the INSERT of the account will fail during registration if you do not add the new column to your existing INSERT statements.