SA-MP Forums Archive
[Ajuda] MYSQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] MYSQL (/showthread.php?tid=590102)



MYSQL - JuniorTheDM - 25.09.2015

Oque Tem de Errado Que Nao Aparece Os Dialog


PHP код:
public OnPlayerConnect(playerid)
{
    new 
query[1024];
    
format(query, sizeof(query), "SELECT * FROM `contas` WHERE `usuario` = '%s'", PlayerName(playerid));
    
mysql_function_query(conexao, query, true, "q_loginRequest", "d", playerid);
    
    
q_loginRequest(playerid);
    return 
1;
}
forward q_loginRequest(playerid);
public 
q_loginRequest(playerid)
{
    new 
rows, fields;
    
cache_get_data(rows, fields);
    
    if(
rows > 0 ){
    
        
//Usuario Existe
        
ShowPlayerDialog(playerid, DIALOG01, DIALOG_STYLE_PASSWORD, "Seja Bem Vindo Novamente", "Digite Sua Senha Abaixo", "logar", "");
        
        } else {
        
        
//Usuario Nao Existe
        
ShowPlayerDialog(playerid, DIALOG02, DIALOG_STYLE_PASSWORD, "Registre sua Conta", "Digite Sua Senha Abaixo", "registrar", "");
    }
} 



Re: MYSQL - garotin - 25.09.2015

Vocк definiu o DIALOG01 e o DIALOG02 ?


Re: MYSQL - JuniorTheDM - 25.09.2015

Sim
PHP код:
#define DIALOG01 433
#define DIALOG02 434 



Re: MYSQL - garotin - 25.09.2015

Da algum erro na hora de compilar?


Re: MYSQL - JuniorTheDM - 25.09.2015

Nenhum ;/


Re: MYSQL - garotin - 25.09.2015

Nгo aparece nenhum dialog?


Re: MYSQL - JuniorTheDM - 25.09.2015

Nenhum Olha Minha GM
http://pastebin.com/0Tvh0jVz


Re: MYSQL - zPain - 25.09.2015

PHP код:
public OnPlayerConnect(playerid) 
{ 
    new 
query[128]; 
    
format(query, sizeof(query), "SELECT * FROM `contas` WHERE `usuario` = '%s'", PlayerName(playerid)); 
    
mysql_function_query(conexao, query, true, "q_loginRequest", "d", playerid); 
     
    return 
1; 
} 
Se nгo resolver, poste o mysql_log.


Re: MYSQL - JuniorTheDM - 25.09.2015

PHP код:
[20:31:03] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:31:05] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:31:05] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:31:05] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:32:53] [WARNING] CMySQLHandle::Create - connection already exists
[20:32:56] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:32:58] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:32:58] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:32:58] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:33:00] [WARNING] cache_get_data - no active cache
[20:33:04] [WARNING] cache_get_data - no active cache
[20:33:41] [WARNING] CMySQLHandle::Create - connection already exists
[20:33:44] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:33:46] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:33:46] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:33:46] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:35:19] [WARNING] CMySQLHandle::Create - connection already exists
[20:35:22] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:35:24] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:35:24] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:35:24] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:36:17] [WARNING] CMySQLHandle::Create - connection already exists
[20:36:20] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:36:22] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:36:22] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[20:36:22] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:14:46] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:14:49] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:14:49] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:14:49] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:21:39] [WARNING] CMySQLHandle::Create - connection already exists
[17:21:41] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:21:44] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:21:44] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:21:44] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:29:00] [WARNING] CMySQLHandle::Create - connection already exists
[17:29:03] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:29:06] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:29:06] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:29:06] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:33:22] [WARNING] CMySQLHandle::Create - connection already exists
[17:33:25] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:33:27] [WARNING] cache_get_data - no active cache
[17:33:27] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:33:27] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:33:27] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:34:02] [WARNING] CMySQLHandle::Create - connection already exists
[17:34:05] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:34:07] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:34:07] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:34:07] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:34:08] [WARNING] cache_get_data - no active cache
[17:35:56] [WARNING] CMySQLHandle::Create - connection already exists
[17:35:59] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:36:01] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:36:01] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:36:01] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:50:23] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:50:25] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:50:25] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0)
[17:50:25] [ERROR] CMySQLConnection::Connect - (error #2005) Unknown MySQL server host 'Host' (0) 



Re: MYSQL - zPain - 25.09.2015

Aparentemente o problema й com a conexгo. Poste os dados da conexгo (host, user e db).


Re: MYSQL - JuniorTheDM - 25.09.2015

PHP код:
#define Host        "localhost"
#define Usuario        "root"
#define DataBase    "samp"
#define Senha        "REAbMeu5jbWdHf34" 
@Edit

http://prntscr.com/8kgoif


Re: MYSQL - zPain - 25.09.2015

Parece correto. Poste a linha com o mysql_connect.


Re: MYSQL - JuniorTheDM - 25.09.2015

PHP код:
conexao = mysql_connect("Host", "Usuario", "DataBase", "Senha"); 



Re: MYSQL - zPain - 25.09.2015

Deixe assim:

PHP код:
conexao = mysql_connect(Host, Usuario, DataBase, Senha); 
Nгo esqueca o mysql_close em OnGameModeExit.


Re: MYSQL - JuniorTheDM - 25.09.2015

Foi mais agr deu esses erros

PHP код:
[17:57:59] [ERROR] CMySQLConnection::Connect - (error #1045) Access denied for user 'root'@'localhost' (using password: YES)
[17:57:59] [ERROR] CMySQLConnection::Connect - (error #1045) Access denied for user 'root'@'localhost' (using password: YES)
[17:57:59] [ERROR] CMySQLConnection::Connect - (error #1045) Access denied for user 'root'@'localhost' (using password: YES)
[17:57:59] [ERROR] CMySQLConnection::Connect - (error #1045) Access denied for user 'root'@'localhost' (using password: YES) 



Re: MYSQL - zPain - 25.09.2015

Parece um problema com a senha. Vocк definiu alguma senha no phpMyAdmin? Se nгo, basta deixar:
PHP код:
#define Senha "" 



Re: MYSQL - JuniorTheDM - 25.09.2015

Arrumei a senha faltava 1 letra mais olha esses erros/WARNING

PHP код:
[18:01:22] [WARNING] CMySQLConnection::Disconnect - no connection available
[18:01:22] [WARNING] CMySQLConnection::Disconnect - no connection available 



Re: MYSQL - zPain - 25.09.2015

Й melhor vocк postar o cуdigo inteiro.


Re: MYSQL - JuniorTheDM - 25.09.2015

http://pastebin.com/0Tvh0jVz


Re: MYSQL - zPain - 25.09.2015

PHP код:
public OnGameModeExit() {
    
mysql_close(conexao);
    return 
1;
}