SA-MP Forums Archive
Mysql kinda crashes sometimes - 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: Mysql kinda crashes sometimes (/showthread.php?tid=471291)



Mysql kinda crashes sometimes - BizzyD - 22.10.2013

WORKING NOW! DELETE THREAD PLEASE


Re: Mysql kinda crashes sometimes - mamorunl - 22.10.2013

Error stems from these lines:
pawn Код:
strcat(QueryFinal, "INSERT INTO `playerdata`(`Username`, `Password`, `AdminLevel`, `HelperLevel`, `Level`, `WaterBottle`, `Faction`, `Rank`, `Leader`, `Team`, `FishingNet`, `Boar`, `Note`, `Rope`, `Fruit`, `Boarmeat`, `FishingRod`, `Skin`, `Sex`, `Water`, `Fish`, `Heroin`, `FireMatches`, `FireWood`,");
    format(Query, sizeof(Query), "`Berry`, `Whiskey`, `Mask`, `Clothes`, `FishDone`, `R-Muted`, `Muted`, `aJailed`, `JailTime`, `RespectPoints`, `CoOwner`, `Skill`, `WalkieTalkie`, `APP`, `GunID`, `GUNMAT`, `GUNMAT2`, `GunID2`, `GunID3`, `GunID4`, `GunID5`, `Ammo`, `Ammo2`, `Ammo3`, `Ammo4`, `Ammo5`,");
    strcat(QueryFinal, Query);
    format(Query, sizeof(Query), "`Pos_X`, `Pos_Y`, `Pos_Z`, `Vip`, `WalkieBroken`, `ChoosenTeam`, `RelationShip`, `RelationWith`, `Interior`, `Warnings`, `Slots`, `SlotsFree`, `BackPack`, `Banned`, `IP`)");
    strcat(QueryFinal, Query);
    format(Query, sizeof(Query), "VALUES('%s',MD5('%s'),0,0,1,0,0,0,0,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,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,'%s')", ReturnPlayerName(playerid), password, IP); strcat(QueryFinal, Query);
Your MySQL log should keep track of the queries that have been submitted. Please count the fields or simplify your SQL (this is really crappy coding, set default values for the insert and let mysql handle it).


Re: Mysql kinda crashes sometimes - BizzyD - 22.10.2013

DELETED


Re: Mysql kinda crashes sometimes - BizzyD - 22.10.2013

DELETED


Re: Mysql kinda crashes sometimes - ikey07 - 22.10.2013

try this by considering you have set default values in the table.

pawn Код:
public RegisterPlayer(playerid, password[])
{
    new Query[500],IP[20];
    GetPlayerIp(playerid, IP, 20);
    format(Query, sizeof(Query), "INSERT INTO `playerdata` (`Username`,`Password`,`IP`) VALUES ('%s',MD5('%s'),'%s')" ,ReturnPlayerName(playerid), password, IP);
    FirstSpawn[playerid] = 1;
    mysql_function_query(conn, Query, false, "OnQuerySend", "", playerid, password); // 67
    return 1;
}



Re: Mysql kinda crashes sometimes - BizzyD - 22.10.2013

worked, thanks ikey