Expression has no effect [MySQL]
#1

pawn Код:
stock SaveItems(playerid)
{
    new query[256];
    format(query),sizeof(query),"UPDATE items SET Mseeds = '%d', Marijuana = '%d', Phone = '%d',PhoneNumber = '%d',Watch = '%d',Beer = '%d',Wine = '%d',Cigarettes = '%d',Ligther = '%d',FishRod = '%d',Bait = '%d', \
    FishBag = '%d WHERE username = '%s'"
, //line 435
    PlayerItems[playerid][Mseeds],PlayerItems[playerid][Marijuana],PlayerItems[playerid][Phone],PlayerItems[playerid][PhoneNumber],
    PlayerItems[playerid][Watch],PlayerItems[playerid][Beer],PlayerItems[playerid][Wine],PlayerItems[playerid][Cigarettes],
    PlayerItems[playerid][Lighter],PlayerItems[playerid][FishRod],PlayerItems[playerid][Bait],PlayerItems[playerid][FishBag],
    Name);
    mysql_query(query);
}
Lines
pawn Код:
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435) : warning 202: number of arguments does not match definition
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435) : warning 202: number of arguments does not match definition
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 436) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 436) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 436) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 436) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 437) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 437) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 437) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 437) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 438) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 438) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 438) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 438) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(435 -- 439) : warning 215: expression has no effect
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(439) : error 001: expected token: ";", but found ")"
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(439) : error 029: invalid expression, assumed zero
C:\Users\Justas\Desktop\testserver 0.3x\gamemodes\rp.pwn(439) : warning 215: expression has no effect
And I just can't find the problem,can you?
Reply
#2

pawn Код:
format(query,sizeof(query),"UPDATE items SET Mseeds = '%d', Marijuana = '%d', Phone = '%d',PhoneNumber = '%d',Watch = '%d',Beer = '%d',Wine = '%d',Cigarettes = '%d',Ligther = '%d',FishRod = '%d',Bait = '%d', \
    FishBag = '%d' WHERE username = '%s'"
, //line 435
    PlayerItems[playerid][Mseeds],PlayerItems[playerid][Marijuana],PlayerItems[playerid][Phone],PlayerItems[playerid][PhoneNumber],
    PlayerItems[playerid][Watch],PlayerItems[playerid][Beer],PlayerItems[playerid][Wine],PlayerItems[playerid][Cigarettes],
    PlayerItems[playerid][Lighter],PlayerItems[playerid][FishRod],PlayerItems[playerid][Bait],PlayerItems[playerid][FishBag],
    Name);
    mysql_query(query);
You added closing bracket right after format(query & another thing that would prevent query from executing is that you forgot ' after %d at FishBag
Reply
#3

Thankyou very much,no errors anymore
Reply
#4

Maybe you see why doesn't it save information?
Reply
#5

Basics of MySQL. All tables and Columns must be between ` ` to prevent Syntax Error:

pawn Код:
..."UPDATE `items` SET Mseeds[...
Reply
#6

that didn't solve it
Reply
#7

You put single-quote tags around your variable replacement specifiers (i.e. you're doing '%d' or '%f'). You ONLY need to do this for strings (or '%s'), for integer values and floats, you should be receiving a syntax error. So, where you have '%d' and/or '%f', change it to %d and/or %f.
Reply
#8

And still nothing is saved
Reply
#9

Getting any MySQL errors then? There's something you're doing wrong/not showing here. Are the fields in the DB spelled correctly? I believe their case sensitive, especially on Linux.

Might try adding mysql_debug(1); to your OnGameModeInit() callback - if you're using BlueG's SQL plugin, that is.
Reply
#10

How stupid of me to not think about cheking the log...I misspelled Lighter in the query. Now it's working thank you everyone
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)