Guest User

Untitled

a guest
Feb 14th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var mysql = require('mysql');
  2. var con = mysql.createConnection({
  3. host: "localhost",
  4. port: "8080",
  5. user: "root",
  6. password: "pass",
  7. database: "db"
  8. });
  9.  
  10. createNewProfile = function (firstName, lastName, type, isActive, securityClearance, location)
  11. {
  12. var newID;
  13.  
  14. var sql = "CALL create_new_profile_id";
  15.  
  16. con.connect(function(err)
  17. {
  18. if(err) throw(err, "Connection to database for creating new profile failed.");
  19.  
  20. con.query(sql, function(err, results)
  21. {
  22. if(err)
  23. {
  24. console.log(err.message);
  25. throw (err, "create_new_profile_id filed.");//this is where the error occurs
  26. }//if
  27.  
  28. newID = results;
  29. });
  30.  
  31. //some more function calls to do other things with the profile
  32. });//connect
  33.  
  34. con.end(function(err){
  35. if (err) throw err;
  36. console.log("Connection closed.");
  37. });
  38. }//create new profile
Add Comment
Please, Sign In to add comment