A
A
Alexander2016-08-23 15:21:38
MySQL
Alexander, 2016-08-23 15:21:38

Why is mysql query not working in nodejs?

Such a query does not work (no errors occur, but nothing changes in the database):

db.query("UPDATE Statistics SET online='" + Online + "', maximumOnline='" + MaximumOnline + "' WHERE date='" + new Date(CurrentStatisticsTime).toISOString() + "'");

Although queries like this work:
db.query("INSERT INTO Statistics (date, online, maximumOnline) VALUE ('" + new Date(CurrentStatisticsTime).toISOString() + "','" + Online + "','" + MaximumOnline + "')");

db.query("SELECT * FROM Statistics WHERE date='" + new Date(CurrentStatisticsTime).toISOString() + "'");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
ff0xff, 2018-07-08
@ff0xff

Because javascript is shit invented by anonists, pass to the anonymous function if (err) throw err; and maybe if you're lucky you'll see what's wrong, although not a fact.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question