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: Mysql_close() (
/showthread.php?tid=602994)
Mysql_close() -
ScIrUsna - 16.03.2016
Hi,
Do i need to close mysql connection when i start but it's was not succefully?
Код:
OnGameModeInit
mysql_connect(...);
if(mysql_errno() != 0)
{
mysql_close(); ?
}
Re: Mysql_close() -
czerwony03 - 16.03.2016
nope
Re: Mysql_close() -
AndySedeyn - 16.03.2016
No. In fact, closing a non-existent connection seems kinda stupid to me. I just print a console message saying whether the connection was successful or not. Perhaps, closing the server is something you could do? Assuming that you use the database for all the data that requires saving, it is an important part of the functionality of your server.
It is really up to you.
Re: Mysql_close() - Whoo - 16.03.2016
just check was successfully connected to the database.
PHP код:
printf("%s", mysql_errno( variable of connection ) == 0 ? ( "successfully connected to the database" ) : ( "failed to connect to the database" ) );