Problem with MySQL connection
#1

Hi

I have a problem with my script and I want to say it in the beginning: I'm apprentice in writing in Pawn, so I need clear and easy to understand instructions how to repair my error. Thank you

So, I have a map, I've downloaded it from the internet. I've fixed some errors and built a MySQL database. When it comes to connecting server to database it returns me an error, here it is:
Код:
[MySQL] Error (0): Function: mysql_connect failed, mysql was not initialized on this handle.
Database of course is running and working properly.

I think that the problem is in the MySQLConnect function, so here is the code of it:

pawn Код:
public MySQLConnect(sqlhost[], sqluser[], sqlpass[], sqldb[])
{
    print("MySQL: Connecting to MySQL...");
    mysql_connect(sqlhost, sqluser, sqlpass, sqldb);
    if(!mysql_ping())
    {
        print("MySQL: Connected to MySQL.");
        return 1;
    }
    else
    {
        print("MySQL: Connection error, retrying...");
        mysql_connect(sqlhost, sqluser, sqldb, sqlpass);
        if(!mysql_ping())
        {
            print("MySQL: Connection established.");
            mysql_free_result();
            return 1;
        }
        else
        {
            print("MySQL: Can't connect with MySQL.");
            SendRconCommand("exit");
            return 0;
        }
    }
}
If you have any question, just ask.
Reply


Messages In This Thread
Problem with MySQL connection - by WH4YER0 - 21.08.2010, 16:01
Re: Problem with MySQL connection - by WackoX - 21.08.2010, 16:15
Re: Problem with MySQL connection - by Toni - 21.08.2010, 16:25
Re: Problem with MySQL connection - by WH4YER0 - 21.08.2010, 16:50
Re: Problem with MySQL connection - by playbox12 - 21.08.2010, 16:55
Re: Problem with MySQL connection - by WH4YER0 - 21.08.2010, 16:58
Re: Problem with MySQL connection - by Toni - 21.08.2010, 17:04
Re: Problem with MySQL connection - by Agent Smith - 21.08.2010, 17:07
Re: Problem with MySQL connection - by playbox12 - 21.08.2010, 17:29

Forum Jump:


Users browsing this thread: 1 Guest(s)