madvalue

MySQL connection

Recommended Posts

I have big problem with my mysql connection

var mysql = require("mysql");

console.log("step 1");
var connection =  mysql.createConnection({
	host		:	"127.0.0.1",
	user		: 	"root",
	password	: 	"",
	database	:	"gtav"
});
console.log("step 2");

connection.connect(function(e) {
	console.log("step 3");
	if (e)
	{
		console.log("<b>DATABASE:</b> Wystąpił problem z połączeniem");
		throw e;
	}
	else
	{
		console.log("<b>DATABASE:</b> Połączono z bazą danych");
	}
});
console.log("step 4");

connection.query("SELECT uuid FROM sq_accounts WHERE uuid=1", function (e, result) {
	console.log(result);
	console.log("step 4");
});
console.log("step 5");

Console print steps 1, 2, 4 and 5, soo connection.connect not work but i don't know why :v

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.