Ni3ls
16th August 2018, 12:38
Hi all,
I want to setup mysql
init()
{
//get your host, user, pass, db, port here
level.mysql = mysql_reuse_connection();
host = getcvar("mysql_host");
user = getcvar("mysql_user");
pass = getcvar("mysql_password");
db = getcvar("mysql_database");
if(!isDefined(level.mysql))
level.mysql = initMySQL(host, user, pass, db, 3306);
initAsyncMySQL(host, user, pass, db, 3306);
}
in the config I have (which is loaded)
set mysql_host "hostname"
set mysql_user "username"
set mysql_password "pw"
set mysql_database "dbname"
This aint working, I get a segmentation fault.
But when I directly write it in the initmysql function, it is working.
init()
{
//get your host, user, pass, db, port here
level.mysql = mysql_reuse_connection();
host = getcvar("mysql_host");
user = getcvar("mysql_user");
pass = getcvar("mysql_password");
db = getcvar("mysql_database");
if(!isDefined(level.mysql))
level.mysql = initMySQL(hostname, username, pw, dbname, 3306);
initAsyncMySQL(hostname, username, pw, dbname, 3306);
}
What could be the problem?
I want to setup mysql
init()
{
//get your host, user, pass, db, port here
level.mysql = mysql_reuse_connection();
host = getcvar("mysql_host");
user = getcvar("mysql_user");
pass = getcvar("mysql_password");
db = getcvar("mysql_database");
if(!isDefined(level.mysql))
level.mysql = initMySQL(host, user, pass, db, 3306);
initAsyncMySQL(host, user, pass, db, 3306);
}
in the config I have (which is loaded)
set mysql_host "hostname"
set mysql_user "username"
set mysql_password "pw"
set mysql_database "dbname"
This aint working, I get a segmentation fault.
But when I directly write it in the initmysql function, it is working.
init()
{
//get your host, user, pass, db, port here
level.mysql = mysql_reuse_connection();
host = getcvar("mysql_host");
user = getcvar("mysql_user");
pass = getcvar("mysql_password");
db = getcvar("mysql_database");
if(!isDefined(level.mysql))
level.mysql = initMySQL(hostname, username, pw, dbname, 3306);
initAsyncMySQL(hostname, username, pw, dbname, 3306);
}
What could be the problem?