07.01.2015, 22:46
algo tipo isto funciona acho:
ja agora qual a diferenзa das 2 DB ?
e que se quer usar 2 base de dados esta fazendo certo agora se quiser salvar e ler na mesma nao esta fazendo certo.
pawn Код:
#define SQL_WRITE 0
#define SQL_READ 1
#define SQL_TYPE SQL_WRITE
#define SQL_HOST "localhost"
#define SQL_DB "sampdb"
#define SQL_USER_WRITE "root"
#define SQL_USER_READ "root"
#define SQL_USER_WRITE_PASS ""
#define SQL_USER_READ_PASS ""
new g_Write, g_Read;
forward SQL_DB_CONNECT();
public SQL_DB_CONNECT()
{
#if defined SQL_TYPE == SQL_WRITE
g_Write = mysql_connect(SQL_HOST, SQL_USER_WRITE, SQL_DB, SQL_USER_WRITE_PASS);
if(mysql_errno() != 0)
{
printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_WRITE);
SendRconCommand("exit");
}
else
{
printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_WRITE);
}
#else
g_Read = mysql_connect(SQL_HOST, SQL_USER_READ, SQL_DB, SQL_USER_READ_PASS);
if(mysql_errno() != 0)
{
printf("FAILED CONNECTION TO DATABASE USING %s --- SERVER SHUTTING DOWN ~~~", SQL_USER_READ);
SendRconCommand("exit");
}
else
{
printf(" SUCCESSFULLY CONNECTED TO DATABASE '%s' WITH USER '%s'", SQL_DB, SQL_USER_READ);
print(" ");
}
#endif
return 1;
}
e que se quer usar 2 base de dados esta fazendo certo agora se quiser salvar e ler na mesma nao esta fazendo certo.