• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Whats different with this 1 line and multi (MySQL)
#1
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?
  Reply
#2
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.
  Reply
#3
Thank you so much
  Reply


Forum Jump: