Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sql = require('mysql');
- var db_config = {
- host: 'localhost',
- user: 'root',
- password: 'uttkarsh',
- database: 'partners_invoice'
- }
- var connection = sql.createConnection(db_config);
- // connection.connect(...) is just a way to test whether database connection
- // is working or not. I'm not sure about it's return value.
- // You need to use that connection object for queries.
- //
- //var con = connection.connect(function(err){
- // if(err) throw err;
- //})
- // User_ID is not defined :
- var User_ID=1234;
- connection.query('SELECT * FROM user_data WHERE User_ID = ?',[User_ID], function(error, result){
- if(error) throw error;
- console.log(result);
- });
- connection.end();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement