• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua db.query update error

elnelson

Lunaria World Dev
Joined
Jun 20, 2009
Messages
579
Solutions
2
Reaction score
58
Location
México
hello otlanders, i want to execute this
Lua:
local st = 7052
db.query("UPDATE `player_storage` SET `key` = "7052" WHERE `value` = "..st.."+1")

i want to give a db storage to a player (current storage + 1) but it doesnt works
this is the error on console

Lua:
')' expected near '7052'
 
you're cutting off the string and inserting a random 7052 between the 2 strings
Lua:
db.query("UPDATE `player_storage` SET `key` = 7052 WHERE `value` = "..st.."+1")
 
you're cutting off the string and inserting a random 7052 between the 2 strings
Lua:
db.query("UPDATE `player_storage` SET `key` = 7052 WHERE `value` = "..st.."+1")
hi, now the storage wont register, maybe it is wrong the syntax, here is how my db looks like.
 

Attachments

keys are unique to each player id, if you're changing key (i have absolutely no idea why you'd want to do this anyways) you're going to end up with duplicate errors because you're creating multiple keys for different values
are you sure you know what you're trying to do? did you actually make the decision to change the key instead of value, or are you just confused on how storages work? because with storages you update values, not keys.
 
keys are unique to each player id, if you're changing key (i have absolutely no idea why you'd want to do this anyways) you're going to end up with duplicate errors because you're creating multiple keys for different values
are you sure you know what you're trying to do? did you actually make the decision to change the key instead of value, or are you just confused on how storages work? because with storages you update values, not keys.
thanks i got the answer :D close thread plx
 
Back
Top