MySQL JavaScript not working

Hi. I tried to do the following:

playerId = PlayerId()

playerServerId = GetPlayerServerId()

playerName = GetPlayerName(playerId)

RegisterCommand('save2', async (source, args, raw) => {

    let argsConcat

    let argString = argsConcat.concat(args)

    print("Teste 1")

    global.exports["mysql-async"].mysql_fetch_all(

        "INSERT INTO main (name, args) VALUES (@name, @args)", { "name": playerName, "args": argString}, (result) => {

            emit("output", source, argString);

    })

    print("Teste 2")    

}, false);

However, it isn’t working. Nothing happens. Nothing is saved in the database. I don’t know what’s wrong.

Anyone?

should be execute

Take a look at: mysql-async Documentation - mysql-async Documentation

1 Like

Thank you, brother. That was it!

By the way, do you know if MySQL works client-side, or it’s only server-side?

it’s only server side, you wouldn’t want clients being able to run queries for you.

1 Like