![]() |
|
[Pawn] Whats different with this 1 line and multi (MySQL) - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10) +--- Thread: [Pawn] Whats different with this 1 line and multi (MySQL) (/showthread.php?tid=788) |
Whats different with this 1 line and multi (MySQL) - Zow - 2019-09-16 Code: ?mysql_format(ourConnection, query, sizeof(query), "UPDATE characters SET pAdmin = %i, pLastSkin = %i, pLevel = %i, pEXP = %i, pMoney = %i, pBank = %i, pPaycheck = %i, pPhone = %i, pLastOnline = '%e', pLastOnlineTime = %i, pAdminjailed = %i, pAdminjailTime = %i WHERE char_dbid = %i",
??PlayerInfo[playerid][pAdmin],
??PlayerInfo[playerid][pLastSkin],
??PlayerInfo[playerid][pLevel],
??PlayerInfo[playerid][pEXP],
??PlayerInfo[playerid][pMoney],
??PlayerInfo[playerid][pBank],
??PlayerInfo[playerid][pPaycheck],
??PlayerInfo[playerid][pPhone],
??ReturnDate(),
??PlayerInfo[playerid][pLastOnlineTime],
??PlayerInfo[playerid][pAdminjailed],
??PlayerInfo[playerid][pAdminjailTime],
??PlayerInfo[playerid][pDBID]);
?mysql_tquery(ourConnection, query);
?
?mysql_format(ourConnection, query, sizeof(query), "UPDATE characters SET pFaction = %i, pFactionRank = %i, pVehicleSpawned = %i, pVehicleSpawnedID = %i, pTimeplayed = %i, pMaskID = %i, pMaskIDEx = %i, pOfflinejailed = 0 WHERE char_dbid = %i",
??PlayerInfo[playerid][pFaction],
??PlayerInfo[playerid][pFactionRank],
??PlayerInfo[playerid][pVehicleSpawned],
??PlayerInfo[playerid][pVehicleSpawnedID],
??PlayerInfo[playerid][pTimeplayed],
??PlayerInfo[playerid][pMaskID][0],
??PlayerInfo[playerid][pMaskID][1],
??PlayerInfo[playerid][pDBID]);
?mysql_tquery(ourConnection, query);And Code: mysql_format(ourConnection, query, sizeof(query), "UPDATE characters SET pAdmin = %i, pLastSkin = %i, pLevel = %i, pEXP = %i, pMoney = %i, pBank = %i, pPaycheck = %i, pPhone = %i, pLastOnline = '%e', pLastOnlineTime = %i, pAdminjailed = %i, pAdminjailTime = %i \
pFaction = %i, pFactionRank = %i, pVehicleSpawned = %i, pVehicleSpawnedID = %i, pTimeplayed = %i, pMaskID = %i, pMaskIDEx = %i, pOfflinejailed = 0 WHERE char_dbid = %i",
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pLastSkin],
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pEXP],
PlayerInfo[playerid][pMoney],
PlayerInfo[playerid][pBank],
PlayerInfo[playerid][pPaycheck],
PlayerInfo[playerid][pPhone],
ReturnDate(),
PlayerInfo[playerid][pLastOnlineTime],
PlayerInfo[playerid][pAdminjailed],
PlayerInfo[playerid][pAdminjailTime],
PlayerInfo[playerid][pFaction],
PlayerInfo[playerid][pFactionRank],
PlayerInfo[playerid][pVehicleSpawned],
PlayerInfo[playerid][pVehicleSpawnedID],
PlayerInfo[playerid][pTimeplayed],
PlayerInfo[playerid][pMaskID][0],
PlayerInfo[playerid][pMaskID][1],
PlayerInfo[playerid][pDBID]);
mysql_tquery(ourConnection, query);Which one should I do? And why? RE: Whats different with this 1 line and multi (MySQL) - George - 2019-09-17 The difference is the number of queries. The second merges both but it has error in syntax (forgot , after the value of `pAdminjailTime ` column and before \ character). As for which one you should use, none of them. Update what is necessary when its value changes. How often does a player change skin, or their admin level is changed? You do not need to re-update all the time for values that change once in long time. RE: Whats different with this 1 line and multi (MySQL) - Zow - 2019-09-17 Thank you so much |