Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

383
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!