Advertisement
Guest User

Untitled

a guest
Feb 6th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var db_abc= express();
  2. var mysql = require('mysql')
  3.  
  4. var connection = mysql.createConnection({
  5. host: 'localhost',
  6. user: 'root',
  7. password: '',
  8. database: 'abc_db'
  9. })
  10.  
  11. connection.connect(function (err) {
  12. if (err) throw err
  13. console.log('You are now connected...')
  14.  
  15. })
  16.  
  17. module.exports = db_abc;
  18.  
  19. var db_abc = require('../db_abc')
  20.  
  21. db_abc.connection.query('SELECT tid, type, status, ' +
  22. 'created, modified, jdp_response FROM jdp_tb_trade ' +
  23. 'WHERE status="TRADE_FINISHED" AND type = "tmall_i18n" ' +
  24. //'AND DATE_ADD(NOW(), INTERVAL ' + start + ' MINUTES) <= modified' +
  25. // 'AND DATE_ADD(NOW(), INTERVAL ' + end + ' MINUTES) >= modified' +
  26. 'ORDER BY modified',
  27. function (err, results) {
  28. if (!err)
  29. console.log('The solution is: ', results);
  30. else
  31. console.log('Error while performing Query.');
  32.  
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement