21.08.2010, 16:01
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:
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:
If you have any question, just ask.

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.
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;
}
}
}