Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $("#addopdfrm").submit(function(){
- var opdname = $("#opdname").val();
- var opdsex = $("#opdsex").val();
- var opdage = $("#opdage").val();
- var opdaddress = $("#opdaddress").val();
- var opdcity = $("#opdcity").val();
- var opdstate = $("#opdstate").val();
- var opdpin = $("#opdpin").val();
- var opdcon = $("#opdcon").val();
- var opdmail = $("#opdmail").val();
- var opdpresfee = $("#opdpresfee").val();
- var odate = new Date();
- var opdmonth = odate.getMonth()+1;
- var opdyear = odate.getFullYear();
- var opdday = odate.getDate();
- var opddate = opdday+"/"+opdmonth+"/"+opdyear;
- var opdtime = Date.now();
- var mysql = require('promise-mysql');
- var connection;
- mysql.createConnection({
- host: 'localhost',
- user: 'root',
- password: '',
- database: 'plasmadoc'
- }).then(function(conn){
- connection = conn;
- return connection.query("INSERT INTO `opdrec` VALUES('', '"+opdname+"', '"+opdage+"', '"+opdsex+"', '"+opdcon+"', '"+opdaddress+"', '"+opdpin+"', '"+opdcity+"', '"+opdstate+"', '"+opdmail+"', '"+opddate+"', 'no', '"+opdtime+"')");
- }).then(function(rows){
- console.log(rows.insertId);
- connection.end();
- }).then(function(rows){
- alert("New OPD Record Added");
- });
- });
- </script>
Add Comment
Please, Sign In to add comment