MySQL not making a new account
#1

Hey guys, this just started not long ago. I logged into my server, and made a new account. Then, I saw that the account wouldn't save and that it wouldn't make a new account in the database. I'm really annoyed, and I tried again and again and it still wouldn't work. Here is my Register stock:

pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[200], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, score, money, IP, Register Date) VALUES('%s', SHA1('%s'), 0, 0, 0, '%s', NOW())", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
    Logged[playerid] = 1;
    return 1;
}

This on OnGameModeInit:

pawn Код:
mysql_query("CREATE TABLE IF NOT EXISTS playerdata(user VARCHAR(24), password VARCHAR(41), Adminlevel INT(11), score INT(20), money INT(20), IP VARCHAR(16) )");
I really hope you can help me here in this hard situation! Thanks
Reply
#2

try this

pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[200], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, score, money, IP, register_date) VALUES('%s', SHA1('%s'), 0, 0, 0, '%s', NOW())", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
    Logged[playerid] = 1;
    return 1;
}
you must not put Space on your database query or else it wouldn't save the newly registered account
Reply
#3

Quote:
Originally Posted by pds2012
Посмотреть сообщение
try this

pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[200], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, score, money, IP, register_date) VALUES('%s', SHA1('%s'), 0, 0, 0, '%s', NOW())", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
    Logged[playerid] = 1;
    return 1;
}
you must not put Space on your database query or else it wouldn't save the newly registered account
Thanks mate. I would +rep but I don't have 50+ score
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)