MySQL - Banco De Dados -
DeYmonD - 27.01.2019
Galera estou com um problema no MySQL que nгo sei como resolver!
Estou utilizando esta definiзгo para conectar ao Banco de Dados, atй ai tudo certo, aн vou abrir o console para iniciar o servidor diz que conectou normalmente, sу que quando eu verifico o status do MySQL in-game ele diz que nгo estб conectado, ou seja, eu estou achando que ele conecta e desconecta rapidamente, mas nгo sei porque isto estб acontecendo, poderiam me dar uma ajuda?
Definiзгo:
PHP код:
// MySQL
#define MYSQL_TIPO 1
#if MYSQL_TIPO == 0
#define HOST "localhost"
#define USUARIO "bplgames_0077"
#define DATABASE "bplgames_0077"
#define SENHA "NS4RUwTgdlv7GDSN"
#elseif MYSQL_TIPO == 1
#define HOST "localhost"
#define USUARIO "bplgames_0077"
#define DATABASE "bplgames_0077"
#define SENHA "NS4RUwTgdlv7GDSN"
#elseif MYSQL_TIPO == 2
#define HOST "localhost"
#define USUARIO "bplgames_0077"
#define DATABASE "bplgames_0077"
#define SENHA "NS4RUwTgdlv7GDSN"
#endif
static MySQL:IDConexao;
OBS: Estou usando o XAMPP para fazer a conexгo ao banco de dados.
Re: MySQL - Banco De Dados -
DanielMatrix - 27.01.2019
https://sampforum.blast.hk/showthread.php?tid=579909
Re: MySQL - Banco De Dados -
ipsLuan - 27.01.2019
Use new ao invйs de static.
E como vocк estб fazendo a conexгo do mysql?
Re: MySQL - Banco De Dados -
Malandrin - 27.01.2019
Mande o cуdigo do
OnGameModeInit(), provavelmente o problema й lб, e use new ao invez de static
Re: MySQL - Banco De Dados -
DeYmonD - 27.01.2019
OnGamemodeInit:
PHP код:
// -------------------------------------------------------- //
mysql_global_options(DUPLICATE_CONNECTIONS, true);
IDConexao = mysql_connect(HOST, USUARIO, SENHA, DATABASE);
print("\n-----------------------------------------------------------\n");
if(mysql_errno(IDConexao) != 0) print("> Falha ao conectar o banco de dados MySQL '"DATABASE"'!\n");
else print("> Banco de dados MySQL '"DATABASE"' conectado com sucesso!\n");
print("-----------------------------------------------------------\n");
Mudei o static para new apareceram os seguintes erros:
PHP код:
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : error 017: undefined symbol "PRECOS"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : warning 215: expression has no effect
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : error 001: expected token: ";", but found ")"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : fatal error 107: too many error messages on one line
Linha do erro: mysql_query(IDConexao, "SELECT * FROM `"PRECOS"`");
Re: MySQL - Banco De Dados -
Malandrin - 27.01.2019
Mude seu
PHP код:
if(mysql_errno(IDConexao) != 0)
para
PHP код:
if(mysql_errno() != 0)
Obs1: Aparentemente nгo tem nada de errado com sua conexгo, tente ver se vocк criou todas as tabelas e verifique o arquivo "mysql" e vк o que informa dentro dele, ele fica localizado na "PASTADOSEUSERVIDOR>logs>plugins>mysql.txt"
@EDIT
Nгo tinha visto, estб dando erro no "PRECOS" pois vocк colocou
` e
" o certo й somente
`
Ficaria assim:
PHP код:
mysql_query(IDConexao, "SELECT * FROM `PRECOS`");
Re: MySQL - Banco De Dados -
DeYmonD - 27.01.2019
PHP код:
Linha 83365( linha do erro ): mysql_query(IDConexao, "SELECT * FROM `"PRECOS"`");
Re: MySQL - Banco De Dados -
DeYmonD - 27.01.2019
Pequena parte da log do mysql:
PHP код:
[11:18:24] [ERROR] error #1146 while executing query "SELECT * FROM `Hostnames`": Table 'bplgames_0077.hostnames' doesn't exist (C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9150)
[11:18:24] [ERROR] cache_get_row_count: no active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151)
[11:18:24] [ERROR] error #1146 while executing query "SELECT * FROM `Hostnames`": Table 'bplgames_0077.hostnames' doesn't exist (C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9150)
[11:18:24] [ERROR] cache_get_row_count: no active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151)
[11:18:28] [ERROR] error #1146 while executing query "SELECT * FROM `Hostnames`": Table 'bplgames_0077.hostnames' doesn't exist (C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9150)
[11:18:28] [ERROR] cache_get_row_count: no active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151)
[11:18:28] [ERROR] error #1146 while executing query "SELECT * FROM `Hostnames`": Table 'bplgames_0077.hostnames' doesn't exist (C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9150)
[11:18:28] [ERROR] cache_get_row_count: no active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151)
[11:18:31] [ERROR] error #1146 while executing query "SELECT * FROM `Hostnames`": Table 'bplgames_0077.hostnames' doesn't exist (C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9150)
[11:18:31] [ERROR] cache_get_row_count: no active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151)
Re: MySQL - Banco De Dados -
DeYmonD - 27.01.2019
Alguйm/