SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 13/07/2015, 11:53 PM   #1
_Play_
Huge Clucker
 
_Play_'s Avatar
 
Join Date: Jun 2014
Location: GTA
Posts: 424
Reputation: 31
Default SQL syntax

Erro
pawn Code:
[20:51:29] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE Usuario='ivis' at line 1

Code:
stock SalvarDados(playerid)
{
    new myQuery[100];
	format(myQuery, 100, "UPDATE `contas` SET `Matou`='%d', `Morreu`='%d', `Dinheiro`='%d', `Skin`='%d', WHERE Usuario='%s'", Player[playerid][pMatou], Player[playerid][pMorreu], GetPlayerMoney(playerid), GetPlayerSkin(playerid) ,GetNome(playerid));
	mysql_tquery(mysql, myQuery, "","");
	print("dados salvos");
	return 1;
}
eu tava usando o nick ivison_r
_Play_ is offline   Reply With Quote
Old 13/07/2015, 11:59 PM   #2
FallweN
Huge Clucker
 
FallweN's Avatar
 
Join Date: Jan 2014
Location: Search on Google
Posts: 444
Reputation: 98
Default Re: SQL syntax

PHP Code:
stock SalvarDados(playerid)
{
    new 
myQuery[100];
    
format(myQuery100"UPDATE `contas` SET `Matou`='%d', `Morreu`='%d', `Dinheiro`='%d', `Skin`='%d' WHERE Usuario='%s'"Player[playerid][pMatou], Player[playerid][pMorreu], GetPlayerMoney(playerid), GetPlayerSkin(playerid) ,GetNome(playerid));
    
mysql_tquery(mysqlmyQuery"","");
    print(
"dados salvos");
    return 
1;

Tenta agora.
__________________

[Tool/Web/Other]
User Control Panel
[GameMode] The Brasil Drift
FallweN is offline   Reply With Quote
Old 14/07/2015, 12:04 AM   #3
_Play_
Huge Clucker
 
_Play_'s Avatar
 
Join Date: Jun 2014
Location: GTA
Posts: 424
Reputation: 31
Default Re: SQL syntax

[21:04:45] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''iviso' at line 1
_Play_ is offline   Reply With Quote
Old 14/07/2015, 12:10 AM   #4
PT
Godfather
 
PT's Avatar
 
Join Date: Nov 2012
Location: Europe
Posts: 7,180
Reputation: 803
Default Re: SQL syntax

Aumenta o tamanho da String.
PT is offline   Reply With Quote
Old 14/07/2015, 12:13 AM   #5
_Play_
Huge Clucker
 
_Play_'s Avatar
 
Join Date: Jun 2014
Location: GTA
Posts: 424
Reputation: 31
Default Re: SQL syntax

Criei uma nova conta e dei gmx salvo a skin certa sem erro, no phpmyadmin marcou a skin 1 só que quando eu loguei, pegou a skin 4.

PHP Code:
    new qntD[1000], rowsfields;
       
cache_get_field_content(0"Skin"qntDmysql);
    
Player[playerid][pSkin] = strval(qntD);

    
SetSpawnInfo(playerid0pSkin1958.37831343.157215.37460000000);
    
SpawnPlayer(playerid); 
@edit

coloquei assim:
SetSpawnInfo(playerid, 0, Player[playerid][pSkin], 1958.3783, 1343.1572, 15.3746, 0, 0, 0, 0, 0, 0, 0);
e pegou normal alguem sabe pq isso ocorreu
_Play_ is offline   Reply With Quote
Old 14/07/2015, 02:13 PM   #6
Ricop522
High-roller
 
Ricop522's Avatar
 
Join Date: Feb 2010
Location: ES
Posts: 2,640
Reputation: 159
Default Re: SQL syntax

Deve ser porque a variavel pSkin não foi inicializada com o Player[playerid][pSkin]

Falta de atenção sua.
__________________
"Any fool can write code that a
computer can understand. Good
programmers write code that
humans can understand."

AJUDA! Programação
Github
Ricop522 is offline   Reply With Quote
Old 14/07/2015, 05:33 PM   #7
n0minal
High-roller
 
n0minal's Avatar
 
Join Date: Mar 2013
Location: Rio de Janeiro
Posts: 4,046
Reputation: 789
Default Re: SQL syntax

A string é pequena, dependendo do número de caracteres de um monte de fatores isso influencia no número de células necessárias para a formatação completa da query, como o PT disse acima, aumente o número de queries para 256 e seu problema estará resolvido.
n0minal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL syntax JaydenJason Scripting Help 3 06/07/2015 12:27 PM
Syntax TonyNames Scripting Help 9 08/12/2013 06:16 PM
Syntax error thefatshizms Scripting Help 6 10/02/2013 04:16 PM
SQL syntax Danny Help Archive 1 29/04/2011 06:32 PM
sql syntax armyoftwo Help Archive 6 08/10/2010 12:53 PM


All times are GMT. The time now is 10:30 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.