This is my client side snippet:
var stuff = 'this: ';
connection.query("SELECT * FROM users", function (err, results) {
stuff += results;
});
io.sockets.emit('numrows', 'rows length is ' + stuff);
This is my server side snippet:
<b id = 'test'></b>
<script>
socket.on('numrows', function(data) {
document.getElementById('test').innerHTML = data;
});
</script>
The HTML gets changed to 'rows length is this: ', meaning that the function fails to return the number of rows. What am I missing?