MySQL register help!
#1

So I am trying to convert my script to mysql with the cache functions and all that and I can't seem to get it working for some reason.

pawn Код:
new query[1024], str[1024];
WP_Hash(pInfo[playerid][pPassword], 129, inputtext);
strcat(str, "INSERT INTO `accounts` (`Username`, `Password`, `IP`, `Admin`, `Helper`, `VIP`, `Money`, `BankAccount`, `Level`, `Respect`, `Age`, `Gender`, `Origin`, `Skin`, `FightStyle`, `Phone`, `PhoneNumber`, `NameChanges`, `Job`, `JobID`, `Paycheck`, ");
strcat(str, "`Warns`, `WarnReason1`, `WarnReason2`, `WarnReason3`, `MutedBy`, `MutedReason`, `MutedTime`, `MutedTill`, `BannedBy`, `BannedReason`, `BannedTime`, `BannedTill`, `JustRegistered`) ");
strcat(str, "VALUES ('%e', '%s', '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s', %d, %d %d, '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', %d', %d, %d)");
mysql_format(gHandle, query, sizeof(query), str, PlayerName[playerid], pInfo[playerid][pPassword], PlayerIP[playerid], 0, 0, 0, 5000, 10000, 1, 0, 0, "None", "None", 101, 5, 0, 0, 0, "None", 0, 0, 0, 0, 0, "None", "None", "None", "None", "None", 0, 0, "None", "None", 0, 0, 1);
mysql_tquery(gHandle, query, "OnAccountRegister", "i", playerid);
Above you see some code inside my register dialog.

This is my OnAccountRegister if needed.
pawn Код:
forward OnAccountRegister(playerid);
public OnAccountRegister(playerid)
{
    pInfo[playerid][pID] = cache_insert_id();
    printf("New account registered. ID: %d", pInfo[playerid][pID]);
   
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "In order to play you need to login.", "Login", "Quit");
    return 1;
}
Does anyone know why it wont register an account into the database? If you do please help me out, I would appreciate it.
Reply
#2

I don't think you can format the string like that and add the values after. I could be wrong, but you could try just doing it all in one format. That's the only thing I can see that could be wrong.
Reply
#3

The reason why I do it like that is because the string is too long to put into one. I originally did what you just said but then I got error on compiling.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)