SA-MP Forums Archive
unknow mysql_ping - 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: unknow mysql_ping (/showthread.php?tid=576776)



unknow mysql_ping - Face9000 - 06.06.2015

Hi, i'm using BlueG's MySQL R33 plugin, im getting troubles while compiling this line:

Код:
if(mysql_ping(mConnectionHandle) == -1)
Unknown version mysql_ping.


Re: unknow mysql_ping - Konstantinos - 06.06.2015

mysql_ping has been removed a long time ago. You do not need to check if the connection is dead so you can reconnect it, there is a parameter (autoreconnect) in mysql_connect which is set to true by default and it will do it for you.

Also update to R39-3.


Re: unknow mysql_ping - Face9000 - 06.06.2015

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
mysql_ping has been removed a long time ago. You do not need to check if the connection is dead so you can reconnect it, there is a parameter (autoreconnect) in mysql_connect which is set to true by default and it will do it for you..
Oh right, thanks.

Quote:

Also update to R39-3

Yes doing now.


Re: unknow mysql_ping - Face9000 - 06.06.2015

Up: Having some problems now while compiling:

PHP код:
for(new connectionCountconnectionCount MYSQL_CONNECTION_TRIESconnectionCount++)
            {
            
mConnectionHandle mysql_connect(SQLHostSQLUserSQLDatabaseSQLPassword);
            if(
connectionCount == MYSQL_CONNECTION_TRIES 1)
            {
                
printf("The server has failed to connect to MySQL the maximum amount of times, shutting down...");
                
SendRconCommand("exit");
                return 
1;
            }
            else
            {
                
printf("Failed to connect to MySQL, retrying...");
            }
            else
            {
            
printf("The server has successfully connected to MySQL!");
            
mysql_log(SQLDebug);
            break;
           }
           } 
error 029: invalid expression, assumed zero

When the 2nd "else" starts.


Re: unknow mysql_ping - Vince - 06.06.2015

Well yeah, you can't have two "else" within the same scope. Do it like this, though:
PHP код:
new connectionCount 1;
do
{
    
printf("connecting, attempt %d / %d"connectionCountMYSQL_CONNECTION_TRIES);
    
mConnectionHandle mysql_connect(...);
}
while(!
mConnectionHandle && connectionCount++ < MYSQL_CONNECTION_TRIES);
if(!
mConnectionHandle)
{
    
// failed to connect shiz
    
return 0;
}
// rest of gamemodeinit