Guest User

Untitled

a guest
Dec 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <script>
  2. $("#addopdfrm").submit(function(){
  3. var opdname = $("#opdname").val();
  4. var opdsex = $("#opdsex").val();
  5. var opdage = $("#opdage").val();
  6. var opdaddress = $("#opdaddress").val();
  7. var opdcity = $("#opdcity").val();
  8. var opdstate = $("#opdstate").val();
  9. var opdpin = $("#opdpin").val();
  10. var opdcon = $("#opdcon").val();
  11. var opdmail = $("#opdmail").val();
  12. var opdpresfee = $("#opdpresfee").val();
  13. var odate = new Date();
  14. var opdmonth = odate.getMonth()+1;
  15. var opdyear = odate.getFullYear();
  16. var opdday = odate.getDate();
  17. var opddate = opdday+"/"+opdmonth+"/"+opdyear;
  18. var opdtime = Date.now();
  19. var mysql = require('promise-mysql');
  20. var connection;
  21.  
  22. mysql.createConnection({
  23. host: 'localhost',
  24. user: 'root',
  25. password: '',
  26. database: 'plasmadoc'
  27. }).then(function(conn){
  28. connection = conn;
  29. return connection.query("INSERT INTO `opdrec` VALUES('', '"+opdname+"', '"+opdage+"', '"+opdsex+"', '"+opdcon+"', '"+opdaddress+"', '"+opdpin+"', '"+opdcity+"', '"+opdstate+"', '"+opdmail+"', '"+opddate+"', 'no', '"+opdtime+"')");
  30. }).then(function(rows){
  31. console.log(rows.insertId);
  32. connection.end();
  33.  
  34. }).then(function(rows){
  35. alert("New OPD Record Added");
  36. });
  37. });
  38.  
  39. </script>
Add Comment
Please, Sign In to add comment