Skip to content

Instantly share code, notes, and snippets.

@theredstapler
Last active April 21, 2017 05:08
Show Gist options
  • Save theredstapler/623a27fe86b0e118736c7e891ba76ff6 to your computer and use it in GitHub Desktop.
Save theredstapler/623a27fe86b0e118736c7e891ba76ff6 to your computer and use it in GitHub Desktop.
Code for electron tutorial
<html>
<head>
<script>window.$ = window.jQuery = require('./jquery-2.1.4.js');</script>
</head>
<body>
<h1>Electron MySQL Example</h1>
<div id="resultDiv"></div>
<script>
var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : null,
database : 'electron_db'
});
connection.connect();
$sql = 'SELECT `emp_id`,`emp_name` FROM `employee`';
connection.query($sql, function (error, results, fields) {
if (error) throw error;
console.log(results);
$('#resultDiv').text(results[0].emp_name);
});
connection.end();
</script>
</body>
</html>
@theredstapler
Copy link
Author

theredstapler commented Apr 20, 2017

Visit Full article at our official site: Electron Mysql tutorial

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment