-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.js
More file actions
34 lines (27 loc) · 773 Bytes
/
database.js
File metadata and controls
34 lines (27 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
var sql = require('mysql');
// const Connection = require('mysql/lib/Connection');
const con = sql.createConnection({
host: 'localhost',
user: 'root',
password: 'password',
database: 'db'
});
con.connect((err) => {
if (err) {
console.log('Error connecting to Db');
return;
}
console.log('Connection established');
});
// con.query("INSERT INTO Coupon (CouponId, DiscountPercentage, IsActive, UserId, VendorId) VALUES (9635270034,22,'1',62631888,63174877);", (err, result) => {
// if (err) {
// console.log(err);
// }
// console.log(result)
// });
con.query("Select * from Coupon where CouponId=9635270034", (err, result) => {
if (err) {
console.log(err);
}
console.log(result)
});