SA-MP Forums Archive
database problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: database problem (/showthread.php?tid=436146)



database problem - Fernado Samuel - 10.05.2013

Removed


Re: database problem - [MG]Dimi - 10.05.2013

Can you show us code for saving and also Structure of Table in phpMyAdmin


Re: database problem - Fernado Samuel - 10.05.2013

Removed


Re: database problem - [HiC]TheKiller - 10.05.2013

Print the query string e.g.

pawn Код:
print(query);
And see what the output is. You might also want to hide your IP + hashes as that's pretty sensitive information.


Re: database problem - [MG]Dimi - 10.05.2013

Column size, set to 30. It's not just MAX_PLAYER NAME. Read Wiki. Also Each Column and Table name has to be between ` ` and all string values between ' ' to avoid syntax error.

Also try to
pawn Код:
print(query)
. That can give you possible cause.


Re: database problem - Fernado Samuel - 10.05.2013

Removed


Re: database problem - [HiC]TheKiller - 10.05.2013

Just under the last format. This will just print data into your console to show if it's actually querying the correct data. If this shows up fine, then put mysql_debug(1); under OnGameModeInit and then post your MySQL log file in your server directory.


Re: database problem - Fernado Samuel - 10.05.2013

Removed


Re: database problem - [MG]Dimi - 10.05.2013

see? Now we know possible cause.

Let's try like this
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    if(!IsPlayerConnected(playerid)) return 1;
    new query[1200], pname[30], IP[15],string[800];
    new year,month,day;
    new timex,minutey,secondz;
    new Bannedby[20];
    format(Bannedby, 20, "Not Banned");
    gettime(timex,minutey,secondz);
    getdate(year, month, day);
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 15);
    strcat(string, "(user, password, IP, score, money, kills, deaths, registered, loggedin, level, cookies, cakes, biscuits, icecreams, XF, Donator, TiP, Function1,");
    strcat(string, "Function2, Function3, Function4, Function5, Function6, Bank, weed, Condoms, inalcatraz, hours, minutes, seconds, SavSkin, UseSkin,  PositionX, PositionY, PositionZ, interior1, RegisteredDate, RegisteredTime, LastOnlineDate, LastOnlineTime, TotalCmdsUsed, Complaints, Banned, BannedByAdmin, TotalLogins, TotalKicks, TotalBans, TotalWarnings, ReactionTestWon, RaceWon, ATMCard, AdminKills,BankCash, HidenPickUp)");
    format(query, sizeof(query), "INSERT INTO playerdata %s VALUES('%s', SHA1('%s'), '%s', 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \'%d-%d-%d\', \'%d:%d:%d\', \'%d-%d-%d\', \'%d:%d:%d\', 0, 0, 0, '%s', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)", string, pname, passwordstring, IP, year, month, day, timex, minutey, secondz, year, month, day, timex, minutey, secondz, Bannedby);
    mysql_query(query);

    savedatatimer[playerid] = SetTimerEx("Savedata", 120000, true, "i", playerid);
    playedtimer[playerid] = SetTimerEx("TimeOnServer", 1000, 1, "i", playerid);
    PlayerInfo[playerid][LoggedIn] = 1;
    PlayerInfo[playerid][Registered] = 1;
    GivePlayerMoney(playerid,50000);
    return 1;
}
Changed name string size to 30 and Added Connection check. If he isn't connected server can't get his name so that could be cause of the problem.


Re: database problem - Fernado Samuel - 10.05.2013

Removed