• 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 executeQuery tfs 1.2

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
Code:
function onThink(interval)
    local godzina = math.random(1,24)
    db.executeQuery("UPDATE `server_config` SET `value` = `zero` + " .. godzina .. " WHERE config = `bon_exp`;")
end

Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/exp.lua:onThink
data/globalevents/scripts/exp.lua:3: attempt to call field 'executeQuery' (a nil value)
stack traceback:
        [C]: in function 'executeQuery'
        data/globalevents/scripts/exp.lua:3: in function <data/globalevents/scripts/exp.lua:1>
[Error - GlobalEvents::think] Failed to execute event: losujexp

Tried also with db.Query but error is the same.
Any ideas how can I fix it? It's TFS 1.2, 10.82.
 
@up
db.Query :D

Code:
[Error - mysql_real_query] Query: UPDATE `server_config` SET `value` = `zero` + 13 WHERE config = `bon_exp`;
Message: Unknown column 'bon_exp' in 'where clause'
[Error - GlobalEvents::think] Failed to execute event: losujexp
Q8mlUeb.png
 
@up
db.Query :D

Code:
[Error - mysql_real_query] Query: UPDATE `server_config` SET `value` = `zero` + 13 WHERE config = `bon_exp`;
Message: Unknown column 'bon_exp' in 'where clause'
[Error - GlobalEvents::think] Failed to execute event: losujexp
Q8mlUeb.png

Have in mind that the argument after WHERE need to be between -> `HERE` <-. Also Where means which of the structures generated will be called. Like, each new account has its own structure and an ID to identify it. Thats what you should call at WHERE. At SET you should call the name of the column you want to modify, and after it the value that this column will be set, in other words, you shouldnt refer directly to the value. Also, update refers to a category like: "accounts, players, bans, etc..". Hope this helps ya
 
Back
Top