SA-MP Forums Archive
[Ajuda] cache_get_row ou cache_get_field_content_int ?? - 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] cache_get_row ou cache_get_field_content_int ?? (/showthread.php?tid=651622)



cache_get_row ou cache_get_field_content_int ?? - ThiagoScottish - 23.03.2018

Olб pessoal, tenho uma duvida bastante perturbadora, atualmente eu nгo sei qual dos 2 uso pra carregar dados do banco de dados, alguйm poderia me aconselhar ?? e gostaria de saber o porque tambйm, ficarei grato se alguйm responder.

PHP код:
    new temp[50];
    
cache_get_row(0,10temp);
    
APlayerData[playerid][Senha] = strval(temp); 
OU

PHP код:
APlayerData[playerid][PlayerMoney] = cache_get_field_content_int(0"Money"); 



Re: cache_get_row ou cache_get_field_content_int ?? - pWesley - 23.03.2018

O mais atual seria o cache_get_field_content_int, e tambйm melhor.


Re: cache_get_row ou cache_get_field_content_int ?? - ThiagoScottish - 23.03.2018

Quote:
Originally Posted by pWesley
Посмотреть сообщение
O mais atual seria o cache_get_field_content_int, e tambйm melhor.
Obrigado por responder, eu uso o cache_get_field_content_int pra carregar dados inteiros como score e dinheiro, tenho dificuldade pra carregar strings tipo senha / frases, como devo usar ?


Re: cache_get_row ou cache_get_field_content_int ?? - Locky_ - 24.03.2018

cache_get_field_content => obtem-se a string
cache_get_field_content_int => retorno inteiro
cache_get_field_content_float => retorno float

Neste caso vocк deve saber o nome da coluna.

Exemplo
PHP код:
cache_get_field_content(0"Senha"APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_field_content_int(0"Score", *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_field_content_float(0"Metragem", *conexгo*); 
cache_get_row => obtem-se string
cache_get_row_int => retorno inteiro
cache_get_row_float => retorno float

Neste caso vocк deve saber o valor da coluna no MySQL.

Exemplo
PHP код:
cache_get_row(01APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_row_int(02, *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_row_float(03, *conexгo*); 
https://sampwiki.blast.hk/wiki/MySQL/R33


Re: cache_get_row ou cache_get_field_content_int ?? - XandyMello - 24.03.2018

Acho desnecessбrio salvar os dados da senha em uma variбvel levando em conta que ela nгo serб utilizada para absolutamente nada apуs o login. Uma Dica: Coloque pro Banco de Dados ler a senha e comparar com a que ele digitou apenas na hora do login.


Re: cache_get_row ou cache_get_field_content_int ?? - ThiagoScottish - 25.03.2018

Quote:
Originally Posted by XandyMello
Посмотреть сообщение
Acho desnecessбrio salvar os dados da senha em uma variбvel levando em conta que ela nгo serб utilizada para absolutamente nada apуs o login. Uma Dica: Coloque pro Banco de Dados ler a senha e comparar com a que ele digitou apenas na hora do login.
Eu tambйm acho desnecessбrio, apenas dei um exemplo para que possam entender oque eu estava querendo, mesmo assim obrigado pela dica.

Quote:
Originally Posted by Locky_
Посмотреть сообщение
cache_get_field_content => obtem-se a string
cache_get_field_content_int => retorno inteiro
cache_get_field_content_float => retorno float

Neste caso vocк deve saber o nome da coluna.

Exemplo
PHP код:
cache_get_field_content(0"Senha"APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_field_content_int(0"Score", *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_field_content_float(0"Metragem", *conexгo*); 
cache_get_row => obtem-se string
cache_get_row_int => retorno inteiro
cache_get_row_float => retorno float

Neste caso vocк deve saber o valor da coluna no MySQL.

Exemplo
PHP код:
cache_get_row(01APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_row_int(02, *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_row_float(03, *conexгo*); 
https://sampwiki.blast.hk/wiki/MySQL/R33
Obrigado mesmo pela explicaзгo locky, conseguir compreender as funзхes perfeitamente, +rep