Metin2 lua query

09/08/2012 20:33 dramcio#1
Code:
function query(sql)
	user = "mt2"
	pw = "mt2!@#"
	local var = {}
	var.pre = ''
	if user ~= nil then
	var.pre = var.pre..' -u'..user
	end
	if pw ~= nil then
	var.pre = var.pre..' -p'..pw
	end
	var.scriptfile = 'sc_'..pc.get_name()..number(1,999)..number(2,999)..number(3,999)
	var.outputfile = 'op_'..pc.get_name()..number(1,999)..number(2,999)..number(3,999)
	sql = string.gsub(sql,'"',"'")
	var.str = "/usr/local/bin/mysql -N -L "..var.pre.." < "..var.scriptfile.." > "..var.outputfile
	script = io.open(var.scriptfile,"a+")
	script:write(sql)
	script:close()
	os.execute(var.str)
	back = io.open(var.outputfile)
	quer = back:read()
	back:flush()
	back:close()
	os.remove(var.scriptfile)
	os.remove(var.outputfile)
	return quer
end
This is my function to use mysql with localhost mysql.

How to use query with external host mysql?

using other IP?
09/08/2012 20:41 Apocalyptum#2
i guess its not possible o.o
otherwise why do you need it? localhost is more safety as a extern host i guess
09/08/2012 21:08 dramcio#3
I need to connect with extain host to insert some thing ;)

/// I can open other website (etc. cron) but from quest. i don't have apache on my freebsd.

how?
09/08/2012 21:11 Mijago#4
mysql -h123.456.789 -x -y -bla

Type this and read : man mysql