my acc won't save on the database.
#1

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?
Reply
#2

I recommend you use inc DOF2 which is easier to use and understand
Reply
#3

I don't know this include.
And i don't know how to use it.
Reply
#4

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.
Reply
#5

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.
Reply
#6

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.
Reply
#7

You are using wrong format for insert. correct format is,

PHP код:
 INSERT INTO players (Column 1Column 2,...) VALUES (value 1value 2,...); 
Reply
#8

Quote:
Originally Posted by GTLS
Посмотреть сообщение
You are using wrong format for insert. correct format is,

PHP код:
 INSERT INTO players (Column 1Column 2,...) VALUES (value 1value 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.
Reply
#9

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)