SA-MP Forums Archive
[Ajuda] Salvamento sql - 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] Salvamento sql (/showthread.php?tid=558889)



Salvamento sql - StrondaXxT - 19.01.2015

Estou tentando salvar um valor somando a um valor ja existente, sу que toda vez que reinicio o server o valor se torna 0.

Код:
public GerarDrogaArmas()
{
   new query[1024];
   new Valor = 100;
   Empresa[EProdutos] = Empresa[EProdutos] + Valor;
   mysql_format(mysql, query, sizeof(query), "UPDATE `empresas` SET `Produto` = %d WHERE `ID` = 1", Empresa[EProdutos]);
   mysql_tquery(mysql, query,"","");
   return 1;
}
O valor й somando e somando de acordo com o timer, sу que toda vez que dou GMX pelo Rcon ou desligo o Dedicado o valor vai a zero! na minha tabela.


Re: Salvamento sql - WendeLKILL - 19.01.2015

Ja verificou se quando o valor й setado muda na tabela?
use o mysql_log(LOG_DEBUG); e manda o debug


Re: Salvamento sql - StrondaXxT - 19.01.2015

Quote:
Originally Posted by WendeLKILL
Посмотреть сообщение
Ja verificou se quando o valor й setado muda na tabela?
use o mysql_log(LOG_DEBUG); e manda o debug
Sim. Salva sу que quando reinicio o server zera a coluna.

Код:
[16:49:43] [DEBUG] mysql_connect - host: "127.0.0.1", user: "root", database: "server2", password: "****", port: 3306, autoreconnect: true, pool_size: 0
[16:49:43] [DEBUG] CMySQLHandle::Create - creating new connection..
[16:49:43] [DEBUG] CMySQLHandle::CMySQLHandle - constructor called
[16:49:43] [DEBUG] CMySQLHandle::Create - connection created (id: 1)
[16:49:43] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[16:49:43] [DEBUG] CMySQLConnection::Connect - connection was successful
[16:49:43] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[16:49:43] [DEBUG] mysql_errno - connection: 1
[16:49:43] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `empresas` SET `Produto` = %d WHERE `ID` = 1"
[16:49:43] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `empresas` SET `Produto` = 0 WHERE `ID` = 1", callback: "(null)", format: "(null)"
[16:49:43] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[16:49:43] [DEBUG] CMySQLConnection::Connect - connection was successful
[16:49:43] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[16:49:43] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:49:43] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 35.210 milliseconds
[16:49:43] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[16:49:49] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `empresas` SET `Produto` = %d WHERE `ID` = 1"
[16:49:49] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `empresas` SET `Produto` = 100 WHERE `ID` = 1", callback: "(null)", format: "(null)"
[16:49:49] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:49:49] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 26.117 milliseconds
[16:49:49] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[16:49:56] [DEBUG] mysql_format - connection: 1, len: 1024, format: "UPDATE `empresas` SET `Produto` = %d WHERE `ID` = 1"
[16:49:56] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `empresas` SET `Produto` = 200 WHERE `ID` = 1", callback: "(null)", format: "(null)"
[16:49:56] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:49:56] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 34.992 milliseconds
[16:49:56] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving



Re: Salvamento sql - ExPLORE - 19.01.2015

veja se tem

pawn Код:
mysql_close();
na callback
pawn Код:
public OnGameModeExit()



Re: Salvamento sql - StrondaXxT - 19.01.2015

Quote:
Originally Posted by ExPLORE
Посмотреть сообщение
veja se tem

pawn Код:
mysql_close();
na callback
pawn Код:
public OnGameModeExit()
Nгo havia colocado. Coloquei e parou de modificar a tabela.