MySql Update After Inserting Nodejs
I made a simple app in nodejs with express framework and ejs template where I can insert into mysql database and see the results, but for some reasons when I insert and refresh the
Solution 1:
you never seem to update the array that are used when rendering '/'
var users = [];
var age = [];
are filled once using the 'select * from users' query but then they are never updated.
you could (in order to understand what is going on) add
console.log(result);
users.push(user_p.user);
in the ok branch of the 'insert into users set ?' request. This will show the new user.
Regarding the 'age', you cannot simply do the same thing because you have a 'var age' local variable shadowing your 'var age' module scope variable.
Post a Comment for "MySql Update After Inserting Nodejs"