MySQL connect
#1

I have some warnings, i believe this is why i get a error 19 on samp-server
pawn Код:
#define MYSQL_HOST "Wont Show"
#define MYSQL_USER "Wont show"
#define MYSQL_PASS "Wont show"
#define MYSQL_DB   "erpgserver"
I removed the IP and other because of hackers.

pawn Код:
public MySQLConnect(sqlhost[], sqluser[], sqlpass[], sqldb[])
{
    FuncLog("MySQLConnect");
    print("MYSQL: Attempting to connect to server...");
    new MySQL:connection;
    mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, connection, 1);
    if(mysql_ping() == 0)
    {
        print("MYSQL: Database connection established.");
        return 1;
    }
    else
    {
        print("MYSQL: Could not connect! Retrying...");
        mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, connection, 1);
        if(mysql_ping()==0)
        {
           
            return 1;
        }
        else
        {
            print("MYSQL: Could not reconnect to Database! Terminating server...");
            SendRconCommand("exit");
            return 0;
        }
    }
}
pawn Код:
WCRP.pwn(48915) : warning 213: tag mismatch
WCRP.pwn(48915) : warning 202: number of arguments does not match definition
WCRP.pwn(48924) : warning 213: tag mismatch
WCRP.pwn(48924) : warning 202: number of arguments does not match definition
Reply
#2

Both mysql_ping lines should look like this:

pawn Код:
if(mysql_ping(mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, connection, 1)) == -1)
You should also remove the mysql_connect above the mysql_ping lines.
Reply
#3

Still the same warnings
Reply
#4

Can you tell us which lines are the warnings? Would help.
Reply
#5

pawn Код:
mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB, connection, 1);
That gets the warnings..
Reply
#6

I'm not too sure what MySQL plugin you are using - But mine works as the following format (Which you should try):

pawn Код:
mysql_connect(SQL_HOST, SQL_USER, SQL_DB, SQL_PASS);
Obviously change the text around according to your details, and goodluck.
Reply
#7

I think StrickenKid's plugin uses the MySQL: tag. BlueG's plugin does not.
Reply
#8

BlueG's plugin does not.
Reply
#9

try remove the #define MYSQL_HOST

and do mysql_connect("Wont Show", "Wont Show" and etc...);
Reply
#10

Show the native of mysql_connect from the mysql include file you are using (#include).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)