PDA

View Full Version : Warning [MySQL]


Nenzittow
26/03/2015, 03:05 PM
Hey guys, I need help...

So, I was making a Login/Register system with MySQL, and this warning appeared:

(1357) : warning 219: local variable "query" shadows a variable at a preceding level


Line of the error:

new Float:X, Float:Y, Float:Z; query[320];


Code:


stock SaveData(playerid)
{
if(Player[playerid][Logged] == false) return 1;
new Float:X, Float:Y, Float:Z, query[320];
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
mysql_format(connection, query, sizeof(query), "UPDATE `players` SET `Money`='%d', `Skin`='%d', `Level`='%d', `Wanted`='%d', `Admin`='%d', `Job`='%d', `Vip`='%d', `House`='%d', `Business`='%d', `Vehicle`='%d', `License`='%d', `PosX`=%.1f, `PosY`=%.1f, `PosZ`=%.1f WHERE `ID`='%d'",
Player[playerid][Skin],
Player[playerid][Level],
Player[playerid][Wanted],
Player[playerid][Admin],
Player[playerid][Job],
Player[playerid][Vip],
Player[playerid][House],
Player[playerid][Business],
Player[playerid][Vehicle],
Player[playerid][License],
GetPlayerMoney(playerid),
Float:X,
Float:Y,
Float:Z,
Player[playerid][ID]);
mysql_tquery(connection, query,"DataSaved", "d", playerid);
return 1;
}

Can anyone help me pls? Thanks! :D

Aly
26/03/2015, 03:08 PM
Replace "query" with some other variable like "query2". You've already declared the variable "query" as a global one.

Konstantinos
26/03/2015, 03:09 PM
"query" is already declared as global so re-name "query" from SaveData function to something else.

Nenzittow
26/03/2015, 03:13 PM
Thank you both! + REP given to you! :cool: