Warning: Expression has no effect [MySQL] (Fixed)
#1

The code in question:

Код:
			new query[256];
			new playerip[16];
			WP_Hash(Player[playerid][Password], 129, inputtext);
			GetPlayerIp(playerid, playerip, sizeof(playerip));
                        //the mysql_format below is where the warning shows up
			mysql_format(g_SQL, query, sizeof(query), "INSERT INTO `players` (`username`, `password`, `ip`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%s', '%e', %f, %f, %f, %f)", Player[playerid][Name], Player[playerid][Password]), playerid, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A);
			mysql_tquery(g_SQL, query, "OnPlayerRegister", "d", playerid);
The errors I get:

Код:
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : error 001: expected token: ";", but found ")"
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : error 029: invalid expression, assumed zero
C:\Users\Karthika\Desktop\cfiles\pawno\main.pwn(212) : warning 215: expression has no effect
I'm currently checking the code to see if there is any mistake, although I'm not sure if I have made any. Please look into this, thank you.

EDIT: Fixed, there was an unnoticed bracket in the code I somehow left out.

Код:
mysql_format(g_SQL, query, sizeof(query), "INSERT INTO `players` (`username`, `password`, `ip`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%s', '%e', %f, %f, %f, %f)", Player[playerid][Name], Player[playerid][Password]), playerid, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A);
Player[playerid][Password] has an unnecessary bracket next to it, hence causing the error. Removing said bracket fixes the issue.
Reply
#2

You added a ) after Player[playerid][Password].

Код:
mysql_format(g_SQL, query, sizeof(query), "INSERT INTO `players` (`username`, `password`, `ip`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%s', '%e', %f, %f, %f, %f)", Player[playerid][Name], Player[playerid][Password], playerid, SPAWN_X, SPAWN_Y, SPAWN_Z, SPAWN_A);
EDIT: Your post was edited after I posted. Glad you solved it anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)