SA-MP Forums Archive
Multiple Line MYSQL - 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: Multiple Line MYSQL (/showthread.php?tid=655248)



Multiple Line MYSQL - Dreandor - 16.06.2018

I want to make for my PlayerSave multiple lines.

PHP код:
mysql_format(handlequerysizeof(query), "UPDATE users SET level = '%d', leben = '%d', holz = '%d', stein = '%d', eisen = '%d',"PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pLeben], PlayerInfo[playerid][pHolz], PlayerInfo[playerid][pStein], PlayerInfo[playerid][pEisen]);
     
mysql_format(handlequerysizeof(query), "%s map = '%d', recht = '%d', alive = '%d',",PlayerInfo[playerid][pMap], PlayerInfo[playerid][pRecht], PlayerInfo[playerid][pAlive]);
    
mysql_format(handlequerysizeof(query), "%s posx = '%f', posy = '%f', posz = '%f', posarg = '%f',",PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz], PlayerInfo[playerid][pPosArg]);
    
mysql_format(handlequerysizeof(query), "%s skinid = '%d' WHERE id = '%d'"PlayerInfo[playerid][pSkinid], PlayerInfo[playerid][pID]);
     
mysql_pquery(handlequery); 
But this Error comes:
Код:
[21:48:24] [ERROR] mysql_format: no value for specifier '%d' passed
[21:48:24] [ERROR] mysql_format: no value for specifier '%f' passed
[21:48:24] [ERROR] mysql_format: no value for specifier '%d' passed
[21:48:24] [ERROR] error #1064 while executing query "UPDATE users SET level = '0', leben = '1', holz = '100', stein = '100', eisen = '100',": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1



Re: Multiple Line MYSQL - KaryM4Life - 16.06.2018

You did not put values for the specifiers as mentioned in the error messages.


Re: Multiple Line MYSQL - Dreandor - 16.06.2018

PHP код:
new Float:xFloat:yFloat:zFloat:ang;
    new 
skin;
    
GetPlayerPos(playeridxyz);
    
skin GetPlayerCustomSkin(playerid);
    
GetPlayerFacingAngle(playeridang);
    
PlayerInfo[playerid][pPosx] = x;
    
PlayerInfo[playerid][pPosy] = y;
    
PlayerInfo[playerid][pPosz] = z;
    
PlayerInfo[playerid][pPosArg] = ang;
    
PlayerInfo[playerid][pAlive] = 1;
    
PlayerInfo[playerid][pSkinid] = skin



Re: Multiple Line MYSQL - Calisthenics - 16.06.2018

You try to re-format the query and use %s placeholder at the beginning but you forgot the argument.
pawn Код:
mysql_format(handle, query, sizeof(query), "%s map = '%d', recht = '%d', alive = '%d',", query, PlayerInfo[playerid][pMap], PlayerInfo[playerid][pRecht], PlayerInfo[playerid][pAlive]);
mysql_format(handle, query, sizeof(query), "%s posx = '%f', posy = '%f', posz = '%f', posarg = '%f',", query, PlayerInfo[playerid][pPosx], PlayerInfo[playerid][pPosy], PlayerInfo[playerid][pPosz], PlayerInfo[playerid][pPosArg]);
mysql_format(handle, query, sizeof(query), "%s skinid = '%d' WHERE id = '%d'", query, PlayerInfo[playerid][pSkinid], PlayerInfo[playerid][pID]);



Re: Multiple Line MYSQL - Dreandor - 16.06.2018

Thanks. It worked