SAMP PING
#1

How come everytime i compile it gives me error on this line?

Код:
stock ConnectMySQL()
{
	dbHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
//	mysql_debug(1);
//	if(mysql_ping() == -1)
	{
	    printf("Failed to connect to MySQL !");
	}
--->	else
	{
		printf("Connected to MySQL !");
	}
	return 1;
}
The error is
Код:
C:\Users\YakupMalikDavut\Desktop\lsrp\gamemodes\rprp.pwn(930) : error 029: invalid expression, assumed zero
Reply
#2

You commented out the if statement so the compiler doesn't know what you're elseing.
Reply
#3

Quote:
Originally Posted by Jamester
Посмотреть сообщение
You commented out the if statement so the compiler doesn't know what you're elseing.
This, so correct code will be

Код:
stock ConnectMySQL()
{
	dbHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
	mysql_debug(1);
        if(mysql_ping() == -1)
	{
	    printf("Failed to connect to MySQL !");
	}
        else if(mysql_ping() > -1)
	{
		printf("Connected to MySQL !");
	}
	return 1;
}
or

Код:
stock ConnectMySQL()
{
	dbHandle = mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
	mysql_debug(1);
        if(mysql_ping() == -1)
	{
	    printf("Failed to connect to MySQL !");
	}
        else
	{
		printf("Connected to MySQL !");
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)