This repository has been archived by the owner on Jun 18, 2024. It is now read-only.
GET / MySQL Node.js #188
Replies: 1 comment
-
Sorry, this is not a nodejs supporting forum. Please ask on Stackoverflow. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm a newbie to mysql, so is there possible to GET data by row and GET data from all of my tables in one function?
here's my code:
getAllBooksModel: function(detail) {
return new Promise ((resolve, reject) => {
if (detail) {
connection.query('SELECT * FROM books WHERE ?', [detail], function (err, res) {
if (err) {
reject(err)
} else {
resolve(res)
console.log(res)
}
})
} else {
connection.query('SELECT * FROM books', function (err, res) {
if (err) {
reject(err)
} else {
resolve(res)
console.log(res)
}
})
}
})
}
Beta Was this translation helpful? Give feedback.
All reactions