[Ajuda] MySQL - Banco De Dados
#1

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.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=579909
Reply
#3

Use new ao invйs de static.
E como vocк estб fazendo a conexгo do mysql?
Reply
#4

Mande o cуdigo do OnGameModeInit(), provavelmente o problema й lб, e use new ao invez de static
Reply
#5

OnGamemodeInit:

PHP код:
// -------------------------------------------------------- //
    
mysql_global_options(DUPLICATE_CONNECTIONStrue);
    
IDConexao mysql_connect(HOSTUSUARIOSENHADATABASE);
    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 001expected token"-string end-"but found "-identifier-"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : error 017undefined symbol "PRECOS"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : warning 215expression has no effect
C
:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : error 001expected token";"but found ")"
C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn(83365) : fatal error 107too many error messages on one line
Linha 
do erromysql_query(IDConexao"SELECT * FROM `"PRECOS"`"); 
Reply
#6

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`"); 
Reply
#7

PHP код:
Linha 83365linha do erro ): mysql_query(IDConexao"SELECT * FROM `"PRECOS"`"); 
Reply
#8

Pequena parte da log do mysql:

PHP код:
[11:18:24] [ERRORerror #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] [ERRORcache_get_row_countno 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] [ERRORerror #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] [ERRORcache_get_row_countno 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] [ERRORerror #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] [ERRORcache_get_row_countno 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] [ERRORerror #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] [ERRORcache_get_row_countno 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] [ERRORerror #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] [ERRORcache_get_row_countno active cache (C:\Users\Mz\Desktop\BPL Games\pawno\include\a_mysql.inc:182 -> C:\Users\Mz\Desktop\BPL Games\gamemodes\BPL.pwn:9151
Reply
#9

Alguйm/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)