10.06.2015, 07:11
yes, possible, but first, you have to create a variable for each one.
now after creating a variable for each one, we will connect to them when server starts, and define the variables:
however, in queries, you should determine the connection handle for each db, example:
as you see in mysql_tquery function, first parameter (the connection handle was c1) be cause we want to execute the query in the "players" database which we defined, we would use c2 for the forum db query.
pawn Код:
new c1, c2; // creating connection handle for each one.
pawn Код:
public OnGameModeInit()
{
c1 = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password); // this is for server database
c2 = mysql_connect(mysql_host2, mysql_user2, mysql_database2, mysql_password2); // this is for forum db.
return 1;
}
pawn Код:
public OnPlayerConnect(playerid)
{
new name[32]; // an example
GetPlayerName(playerid, name, sizeof name); // an example
mysql_tquery(c1, "SELECT `Password` FROM `players` WHERE `name`='%s' LIMIT 1", "CheckPlayer", "i", playerid);
return 1;
}

