I would like to get the MySQL table information as below and sort the process by pressing button.
However, if there are two placeholders, such as updatesql, I don't know how to specify them on the node side.
const checksql="SELECT* FROM users WHERE name=?";
const checkname="SELECT status FROM users WHERE name=?";
const updatesql="UPDATE users SET?WHERE?";
if(req.body.begin_button){
var name_checked = wait query(checksql, {name:req.body.input_name});
var status_checked = wait query(checkname, {name:req.body.input_name});
if(name_checked==0){
var results=wait query(sql, {id:id, name:req.body.input_name, email:req.body.input_mail, start:now,status:1});
} else {
console.log("error");
};
}
else if(req.body.finish_button){
if(name_checked!=0){
var results = wait query (updatesql, {end:now, status:0});
} else {
console.log("error");
}
}
else if(req.body.start_button){
if(status_checked==1){
var results = wait query (updatesql, {restbegin:now, status:2});
} else {
console.log("error");
};
} else if (req.body.end_button) {
if(status_checked==2){
var results = wait query (updatesql, {restend:now, status:3});
} else {
console.log("error");
};
};
UPDATE users SET xxx=?, xxx=?WHERE xxx=?
I was able to solve this problem by bringing it into each If statement.
Thank you.
© 2024 OneMinuteCode. All rights reserved.