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,10, temp);
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(0, 1, APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_row_int(0, 2, *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_row_float(0, 3, *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(0, 1, APlayerData[playerid][PlayerPassword], *conexгo*, 64);
APlayerData[playerid][PlayerScore] = cache_get_row_int(0, 2, *conexгo*);
APlayerData[playerid][StatsMetersDriven] = cache_get_row_float(0, 3, *conexгo*);
https://sampwiki.blast.hk/wiki/MySQL/R33
|
Obrigado mesmo pela explicaзгo locky, conseguir compreender as funзхes perfeitamente, +rep