Mysqll connect failed i need mysql_close? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysqll connect failed i need mysql_close? (
/showthread.php?tid=543591)
Mysqll connect failed i need mysql_close? -
Banditukas - 27.10.2014
I mean
Код:
mysql_connect( ... ).
if(mysql_errno() != 0)
{
mysql_close();
}
Re: Mysqll connect failed i need mysql_close? -
Thomaske - 27.10.2014
Tr this, thats the wy it need to be used.
pawn Код:
//put this on top of your scrip in the defines and fill them in correctly.
#define mysql_host "yourhost"//mostly localhost
#define mysql_user "yourusername"
#define mysql_password "yourpassword"
#define mysql_database "yourdatabasename"
new MySQLCon;//add this on top of your script (with the global variables)
public OnGameModeInit()
{
MySQLCon = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);//connection string
if(mysql_errno(MySQLCon) != 0) print("Could not connect to database!");//check for errors
mysql_log(LOG_ERROR | LOG_WARNING, LOG_TYPE_HTML);//error/warning logs in main folder of server (mysql_log.txt)
//rest of OnGameModeInit
return 1;
}
i hope i helped you.