0
I would like to know what is wrong with those lines, especially in the query, as it is not working:
pool.query('SELECT * FROM `info` WHERE `id` = 1', function(err, row1) {
var jogo = row1[0].jogo;
var numerojogadores = row1[0].numerojogadores;
// Se o numero de jogadores for 2 ou mais começa...
if (numerojogadores > 1) {
// Inicio do Contador
socket.broadcast.emit('count', count);
count--;
console.log(count);
// Fim do Contador
}
if (count === 0) {
var novojogo = "jogo2";
pool.query('UPDATE info SET jogo = novojogo WHERE id = 1', function(err) {
console.log(err);
count = 60;
});
}
});
What’s wrong with you?
– Sergio
Unknow column '1'
– Gonçalo
Won’t this error be another query? Tests run this UPDATE directly in mysql, gives the same error?
– Sergio
'UPDATE info SET jogo = novojogo WHERE id = 1'
?– OnoSendai
Directly in mysql works, I will leave my code all.
– Gonçalo
I put all the code.
– Gonçalo
If you replace var with a number, it already works. Does anyone know any way to put vars?
– Gonçalo
Dude I think this problem is related to the backticks you put in. Which is the line that gives the error?
– KhaosDoctor
I already realized, I would have to put it this way: '+var+'
– Gonçalo