MySql Error.
#1

Код:
public OnPlayerDisconnect(playerid, reason)
{

    new string[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    switch(reason)
    {
        case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
        case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
        case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
    }
    SendClientMessageToAll(0xFFFFFFAA,string);
    
    if(Logged[playerid] == 1)
    {
        new score = GetPlayerScore(playerid); 
        new money = GetPlayerMoney(playerid);
        new admin = pAdmin[playerid];
        new skin = GetPlayerSkin(playerid);
		new Float:Health;
		new Float:Armour;
		GetPlayerHealth(playerid, Health);
		GetPlayerArmour(playerid, Armour);
		new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid,X,Y,Z);
		new vw = GetPlayerVirtualWorld(playerid);
		new interior = GetPlayerInterior(playerid);
        new query[200], pname[24];
        new jpho = JPHO[playerid];
        new fwo = FWO[playerid];
        new rso = RSO[playerid];
        new so = SO[playerid];
        
  		GetPlayerName(playerid, pname, 24);
        format(query, sizeof(query), "UPDATE playerdata SET score=%d, money=%d, admin=%d, skin=%d, health=%f, armor=%f, xchord=%f, ychord=%f, zchord=%f, virtualw=%d, interior=%d, JPHO=%d, FWO=%d, RSO=%d, SO=%d WHERE user='%s'", score, money, admin,skin,Health,Armour,X,Y,Z,vw,interior,jpho,fwo,rso,so,pname);
        mysql_query(query);
    }
    return 1;
}
Код:
[20:14:38] CMySQLHandler::Query(UPDATE playerdata SET score=0, money=0, admin=5, skin=0, health=0.000000, armor=0.000000, xchord=2051.163574, ychord=1278.466064, zchord=11.037828,virtualw=0,interior=0,JPHO=1,FWO=1,RSO=1,SO=1 WHERE ) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1)
Reply
#2

Your array for storing the query is not long enough, make it longer. You'll need probably around 230 cells to store that entire string after it has been formatted.
Reply
#3

Wonderful. By bumping the Query up to 230 it worked. Thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)