Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

385
Vistas
MySQL Query in JavaScript is not actually executing but using PHPMyAdmin does actually works

today, trying to make a tag system for a discord bot, I finally got to this query:

INSERT INTO tags_935339484147503174 (name, description, author, uses, id) VALUES ('error4', '\n> 📝 El bot se apaga cada que sale un error\n\nEn node 16 en adelante creo el bot siempre se apagara cada que tenga un error pero solo añadiendo este sencillo codigo ya no pasara.\n\n```js\nprocess.on(\'unhandledRejection\', error => {\n console.error(error);\n});\n\nclient.on(\'shardError\', error => {\n console.error(error);\n});\n```', '573991320897716224', 0, 'EKBL63t')

The problem is, that when I execute it from the server

let values = `('${tag.name}', '${tag.description}', '${tag.author ?? '796767810054258719'}', ${tag.uses ?? 0}, '${id}')`.replace(/\n/gm, "\\n")
            let query = `INSERT INTO tags_${guildf.id} (name, description, author, uses, id) VALUES ${values}`            
            console.log(query)
            this._pool.getConnection((_err, con) => {
                con.query(query, (err) => {
                    if(err) rej(err)
                })
                con.release()
            })

It makes nothing, BUT when I execute it from a MySQL Client like HEIDISQL or PHPMyAdmin it actually works, what seems a little to strange for me, because everything points that the error is in the query on JS side, but I can't find such error, would someone please help me? Thanks

Just an update: I'm getting ER_TRUNCATED_WRONG_VALUE_FOR_FIELD and I know it's for having an incorrect db collation, can someone tell me which one would I need to store that text? I'm actually using utf8mb4_0900_ai_ci

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda