Results 1 to 10 of 11

Thread: mysql init

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts

    mysql init

    Hi all,

    I want to setup mysql
    Code:
    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)
    Code:
    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.
    Code:
    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?

  2. The Following User Says Thank You to Ni3ls For This Useful Post:

    kung foo man (16th August 2018)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •