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



MySQL plz? - F1N4L - 22.05.2016

Estou comeзando com MySQL e estou tendo problemas para getar os valores do bd.

O seguinte code estб crashando o servidor por algum motivo e nгo sei qual й!
Код:
            format(MySQL_Format, sizeof(MySQL_Format), "SELECT * FROM `"DATABASE_NOME"` WHERE `"NOME_DB"` = '%s' AND `"SENHA_DB"` = SHA1('%s')", GetName(playerid), InputPass);
            mysql_query(MySQL_Format);
            mysql_store_result();
            if(mysql_num_rows())
            {
				while(mysql_fetch_row_format(MySQL_Format))
				{
					mysql_fetch_field_row(pInfoNome[playerid], "NOME");
					mysql_fetch_field_row(pInfoIP[playerid], "IP");
				}
				
				SendClientMessage(playerid, -1, "Logado com sucesso!");
			}
MySQL Debug:
Quote:

[21:03:04]

[21:03:04] ---------------------------

[21:03:04] MySQL Debugging activated (05/21/16)

[21:03:04] ---------------------------

[21:03:04]

[21:03:04] >> mysql_query( Connection handle: 1 )

[21:03:04] CMySQLHandler::Query(CREATE TABLE IF NOT EXISTS `USUARIOS` ( `NOME` VARCHAR(24) NOT NULL DEFAULT 'N/A', `SENHA` VARCHAR(129) NOT NULL DEFAULT 'N/A', `IP` VARCHAR(16) NOT NULL DEFAULT 'N/A', `MATOU` INT(10) NOT NULL DEFAULT '0', `MORREU` INT(10) NOT NULL DEFAULT '0', `DINHEIRO` INT(20) NOT NULL DEFAULT '0')) - Successfully executed.

[21:03:05] >> mysql_query( Connection handle: 1 )

[21:03:05] CMySQLHandler::Query(SELECT `NOME` FROM `USUARIOS` WHERE `NOME` = 'BETA_Tester') - Successfully executed.

[21:03:05] >> mysql_store_result( Connection handle: 1 )

[21:03:05] CMySQLHandler::StoreResult() - Result was stored.

[21:03:05] >> mysql_num_rows( Connection handle: 1 )

[21:03:05] CMySQLHandler::NumRows() - Returned 1 row(s)

[21:03:05] >> mysql_free_result( Connection handle: 1 )

[21:03:05] CMySQLHandler::FreeResult() - Result was successfully free'd.

[21:03:08] >> mysql_real_escape_string( Connection handle: 1 )

[21:03:08] CMySQLHandler::EscapeString(Edu9944); - Escaped 7 characters to Edu9944.

[21:03:08] >> mysql_query( Connection handle: 1 )

[21:03:08] CMySQLHandler::Query(SELECT * FROM `USUARIOS` WHERE `NOME` = 'BETA_Tester' AND `SENHA` = SHA1('Edu9944')) - Successfully executed.

[21:03:08] >> mysql_store_result( Connection handle: 1 )

[21:03:08] CMySQLHandler::StoreResult() - Result was stored.

[21:03:08] >> mysql_num_rows( Connection handle: 1 )

[21:03:08] CMySQLHandler::NumRows() - Returned 1 row(s)

[21:03:08] >> mysql_fetch_row_format( Connection handle: 1 )

[21:03:08] CMySQLHandler::FetchRow() - Return: BETA_Tester|ea58e7ed2b8662859d516e5a28e44a8502bdbf ca|127.0.0.1|0|0|0

[21:03:08] >> mysql_fetch_field_row( Connection handle: 1 )

[21:03:08] CMySQLHandler::FetchField("NOME") - BETA_Tester

[21:03:08] >> mysql_fetch_field_row( Connection handle: 1 )




Re: MySQL plz? - ZEDD666 - 22.05.2016

eu uso cache_get_field_content setar normalmente os dados do player


Re: MySQL plz? - F1N4L - 22.05.2016

Quote:
Originally Posted by ZEDD666
Посмотреть сообщение
eu uso cache_get_field_content setar normalmente os dados do player
Como eu disse, sou um 0 a esquerda em MySQL, estou comeзando agora e a versгo com cachк й R7.
Estou usando a R6!


Re: MySQL plz? - zPain - 22.05.2016

Esse tutorial parece ter sido feito utilizando a mesma versгo que vocк: https://sampforum.blast.hk/showthread.php?tid=299675

Recomendo trocar para R7 ou superior. Vocк diz estar usando o R6 por estar dando os primeiros passos no assunto, mas a R7 e suas superiores apenas facilitam e organizam o trabalho.

Conforme as versхes saem, o plugin recebe melhorias e, eventualmente, alteraзхes na aplicaзгo no pawn. Mais importante do que isso, й vocк possuir o conhecimento em SQL. Se vocк nгo sabe preparar uma consulta, de nada adiantarб saber aplicar qualquer versгo em pawn.


Re: MySQL plz? - CaioTJF - 22.05.2016

Nгo tem porquк vocк aprender ou estudar funзхes de uma versгo ultrapassada do MySQL no pawn.
Vocк estaria estudando sу como fazer querys, entгo porquк nгo fazer os dois juntos, estudando a versгo atual e realizando querys?


Re: MySQL plz? - F1N4L - 22.05.2016

Eu havia lido no tуpico oficial do BlueG que a versгo R7 nгo era pra iniciantes e talz, aн pensei e utilizar a R6.


Re: MySQL plz? - ZEDD666 - 22.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Eu havia lido no tуpico oficial do BlueG que a versгo R7 nгo era pra iniciantes e talz, aн pensei e utilizar a R6.
Isso nгo mudar em nada cara

Paulo fez uma vнdeo aula jб faz tempo https://www.youtube.com/watch?v=TMjhd95kAy8 1hrs de vнdeo e vocк jб aprende tudo certo


Re: MySQL plz? - F1N4L - 22.05.2016

Quote:
Originally Posted by ZEDD666
Посмотреть сообщение
Isso nгo mudar em nada cara

Paulo fez uma vнdeo aula jб faz tempo https://www.youtube.com/watch?v=TMjhd95kAy8 1hrs de vнdeo e vocк jб aprende tudo certo
Vlw, vou dar uma olhada.


Re: MySQL plz? - ZEDD666 - 22.05.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Vlw, vou dar uma olhada.
Sу nгo vai criar esse sistema de login dele nгo kk


Re: MySQL plz? - F1N4L - 22.05.2016

@TOPIC

RESOLVIDO