Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ER_BAD_FIELD_ERROR New ESX #10

Open
RuisSoftware opened this issue May 12, 2020 · 5 comments
Open

ER_BAD_FIELD_ERROR New ESX #10

RuisSoftware opened this issue May 12, 2020 · 5 comments

Comments

@RuisSoftware
Copy link

Can someone update this line to new ESX?

MySQL.Sync.execute('UPDATE users SET bank = bank + @bank WHERE identifier = @Identifier',{['@bank'] = money, ['@Identifier'] = identifier})

bank is not a bank column anymore. It's merged with money, black_money in the same column called accounts.

@Elipse458
Copy link
Owner

not gonna be supporting new esx versions anytime soon, sorry

@RuisSoftware
Copy link
Author

:(

@RuisSoftware
Copy link
Author

Maybe someone else?

Can't you open it for a bit longer time ?

@Elipse458 Elipse458 reopened this May 12, 2020
@christerjohansson
Copy link

christerjohansson commented May 13, 2020

Is the script working otherwise? Is it just the database query that is the problem?
If it is, it should be possible to concatenate the result into a json-encoded result in that exact field (accounts).
Check how the othe esx_banking scripts are doing the transaction, and do the same with this script. :)
Something like this?
xPlayer.addAccountMoney('bank', tonumber(amount))

Ref: ESX-Banking

EDIT: It is es_extended that works with MySQL and database queries (Ref. https://github.com/ESX-Org/es_extended/blob/master/server/main.lua)

@xqth
Copy link

xqth commented Jul 26, 2020

MySQL.Async.fetchAll("SELECT accounts FROM users WHERE identifier = @identifier", {
    ["@identifier"] = identifier
}, function(result)
    if result[1].accounts and result[1].accounts ~= "" then
        local accounts = json.decode(result[1].accounts)
        accounts.bank = accounts.bank + money
        MySQL.Sync.execute("UPDATE users SET accounts = @accounts WHERE identifier = @identifier", {
            ["@accounts"] = json.encode(accounts),
            ["@identifier"] = identifier
        })
    end
end)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants