/ home / code / using node.js with mysql /

Using Node.js with MySQL

11:14 pm, February 25, 2016 670 495 2.5 @ 200 wpmrate up KruXoR source
1

Original Post Date: 8:54 am, August 30, 2014

Check out the node.js module list

node-mysql looks simple enough:

var mysql = require('mysql');var connection = mysql.createConnection({ host : 'example.org', user : 'bob', password : 'secret',});connection.connect(function(err) { // connected! (unless `err` is set)});

 

Queries:

var post = {id: 1, title: 'Hello MySQL'};var query = connection.query('INSERT INTO posts SET ?', post, function(err, result) { // Neat!});console.log(query.sql); // INSERT INTO posts SET `id` = 1, `title` = 'Hello MySQL'

 

stackoverflow.com
11:14 pm, February 25, 2016 670 495 source

Comments

Reports

Add Report

Report's

KruXoR

This is a site where i basically just post whatever i feel like at the time, it has no one particular topic but usually. Just my ideas and links and random bits of code that i find.

Follow Me..

@KruXoR

Minecraft

Looking for the kruxor minecraft server mc.kruxor.com? we have migrated it to... icekraft.com if you want to play on there just connect to play.icekraft.com:25535 or mc.kruxor.com should also still work.

Favorite Links