Mysql format
#5

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
Is that not what is causing the issue because the statement does not know where to update?
Here's the full code.

pawn Код:
forward SavePlayerInformation(playerid);
public SavePlayerInformation(playerid)
{
    new Float:x, Float:y, Float:z, Float:a, Float:health, Float:armour;
    GetPlayerPos(playerid, x, y ,z); GetPlayerFacingAngle(playerid, a);
    PlayerInformation[playerid][pLastX] = x; PlayerInformation[playerid][pLastY] = y; PlayerInformation[playerid][pLastZ] = z; PlayerInformation[playerid][pLastA] = a;
    GetPlayerHealth(playerid, health); GetPlayerArmour(playerid, armour);
    PlayerInformation[playerid][pHealth] = health; PlayerInformation[playerid][pArmour] = armour;
    mysql_format(MySQLCon, mysqlquery, sizeof(mysqlquery), "UPDATE `accounts` SET `name` = '%e', `accent` = '%e', `password` = '%e'", PlayerInformation[playerid][pName], PlayerInformation[playerid][pAccent], PlayerInformation[playerid][pPassword]);
    mysql_format(MySQLCon, mysqlquery, sizeof(mysqlquery), "%s, `money` = '%d', `bank` = '%d', `health` = '%f', `armour` = '%f'", mysqlquery, PlayerInformation[playerid][pMoney], PlayerInformation[playerid][pBank], PlayerInformation[playerid][pHealth], PlayerInformation[playerid][pArmour]);
    mysql_format(MySQLCon, mysqlquery, sizeof(mysqlquery), "%s, `lastx` = '%f', `lasty` = '%f', `lastz` = '%f', `lasta` = '%f'", mysqlquery, PlayerInformation[playerid][pLastX], PlayerInformation[playerid][pLastY], PlayerInformation[playerid][pLastZ], PlayerInformation[playerid][pLastA]);
    mysql_format(MySQLCon, mysqlquery, sizeof(mysqlquery), "%s, `interior` = '%d', `world` = '%d'", mysqlquery, GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid));
   
    mysql_format(MySQLCon, mysqlquery, sizeof(mysqlquery), "%s WHERE `uniqueid` = '%d'", mysqlquery, PlayerInformation[playerid][pUniqueID]);
    mysql_query(MySQLCon, mysqlquery);
    printf("%s", mysqlquery);
    return 1;
}
The first format doesn't work, the second one does. However it uses the mysqlquery that was last formatted before that.

So for example, if mysqlquery was formatted to "NULL" in a previous code, it will use "NULL" instead of formatting to the first line.
Reply


Messages In This Thread
Mysql format - by Jack_Leslie - 06.03.2017, 07:04
Re: Mysql format - by JessThompson - 06.03.2017, 07:10
Re: Mysql format - by Jack_Leslie - 06.03.2017, 07:11
Re: Mysql format - by JessThompson - 06.03.2017, 07:12
Re: Mysql format - by Jack_Leslie - 06.03.2017, 07:15
Re: Mysql format - by JessThompson - 06.03.2017, 07:17
Re: Mysql format - by Jack_Leslie - 06.03.2017, 10:02
Re: Mysql format - by Unte99 - 06.03.2017, 10:11
Re: Mysql format - by Jack_Leslie - 06.03.2017, 10:17
Re: Mysql format - by Gammix - 06.03.2017, 12:26

Forum Jump:


Users browsing this thread: 1 Guest(s)